For a different variation on the same theme, try
$string =~ s/(?<!\\)'/\\'/g;
Though this raises the question "what if the string contains a backslash followed by a single quote?" Which makes the regex slightly more complicated, and leads back to he conclusion that quotemeta might not be such a bad idea, after all...
Update: while I'm writing silly regexes...
$string =~ s/(?<!\\)(?=')/\\/g;
<duck>
In reply to Re: Re: finding '
by ChemBoy
in thread finding '
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |