I have a follow up question to this post: RegEx to exclude match if a certain word is present, but not another partial word .
If given the following string.
x*vec*grad(vec)
How do I find 'vec' but not 'grad(vec)'?
I am assuming I will need to use something like the following for the search expression, but this doesn't work for me.
vec(?!(?<=grad\(vec))
I also want to ignore the space inside the parentheses, i.e. it should work for the following.
x*vec*grad( vec )
I am using MATLAB's regexp function. Thanks.