Given the following example:
str = 'deriv*dot(N,iv)';
expr = 'iv';
idx = regexp(str,expr);
This returns idx with 4 and 13. How do I only find the ‘iv’ that is NOT part of a word?
I tried messing around with Lookaround Operators for expr, but could not get the result I desired. Thanks for the help.
It seems like Matlab has it’s own word boundary escape sequence.
That defines a word as anything that consists of letters, digits and underscores. If you want your own definition (i.e. letters only), then you need lookarounds: