0

I asked this question to create a GREP style to make the 2 subscript when I typed H2.

I need the GREP to ignore the word H2Van.

I thought to amend the GREP to look for a space after the 2 as well as to look for a H or any uppercase letter before it. This does work, but if there is punctuation after the H2, then the GREP also ignores it.

How would I amend this GREP to ignore the word H2Van?

(?<=\u)2(?=[[:space:]])
0

If it's just the 2 followed by a V, put the negative expression for the V after the 2 (?!V)

(?<=\u)2(?!V)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.