in reply to Escape single quote marks in words

The easiest way to think of this may be:

replace ' with \' if it lies between two letters
.. which you can do like this:
s/(?>=\w)'(?=\w)/\\'/g;
.. or like this:
s/\b'\b/\\'/g;

Hugo

Replies are listed 'Best First'.
Re: Re: Escape single quote marks in words
by kiat (Vicar) on May 28, 2004 at 00:37 UTC
    Thanks, Hugo!

    Your regex is more precise and less prone to errors than the one I've, which uses a comma as the context.