Using vi, I want to match a string, but only if the line doesn’t end with some letter, say Q.
E.g., if the file is:
myQ
my
I want to match the first line but not the second.
From reading related posts it would seem that look aheads should work:
/[?=my][?!Q]
should find just the second line
but it finds the first.
I’d go with the following