in reply to Regex matching on anywhere but the beginning or end of a line
This means literally 'A double-quote that is preceded by a any char and followed by any char'. See perldoc perlre for the details.my $t = q["string (12" or 1 foot or 1') into 6" MySQL varchar"]; $t =~ s/(?<=.)"(?=.)/""/g; print "$t\n";
•Update: corrected terminology
•Update: if the string can contain newlines, don't forget to add the /s modifier to the substitution
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex matching - Thanks on anywhere but the beginning or end of a line
by Anonymous Monk on Feb 24, 2003 at 16:37 UTC |