I need to find and replace all occurrences of apostrophe character in a string, but only if this apostrophe is not followed by another apostrophe.
That is
abc’def
is a match but
abc”def
is NOT a match.
I’ve already composed a working pattern – (^|[^'])'($|[^']) but I believe it may be shorter and simpler.
Thanks,
Valery
depends on your environment – if your environment supports lookahead and lookbehind, you can do this:
(?<!')'(?!')Ref: http://www.regular-expressions.info/lookaround.html