in reply to Regex matching on anywhere but the beginning or end of a line

In a similar vein, you could match the characters before and after using a character class that says "anything but quote", then put those into the replacement string like this:

$x =~ s/([^"])"([^"])/$1""$2/g;

Replies are listed 'Best First'.
Re: Re: Regex matching on anywhere but the beginning or end of a line
by xmath (Hermit) on Feb 23, 2003 at 00:19 UTC
    Eh, no, multiple consecutive quotes is probably perfectly legal, and your substitution wouldn't handle them right.

      Um, yes ... in a similar incorrect vein. Forget mine and use xmath's suggestion.