in reply to Re^3: Regex: Capturing and optionally replacing
in thread Regex: Capturing and optionally replacing

Okay... this one kept me awake last night :(

Because I'd still like to know... how could I have re-written the original expression to get rid of the unwanted commas?

Can somebody please put me out of my misery?
(I promise I won't use it in production :D)

  • Comment on Re^4: Regex: Capturing and optionally replacing

Replies are listed 'Best First'.
Re^5: Regex: Capturing and optionally replacing
by ikegami (Patriarch) on Dec 09, 2005 at 06:18 UTC

    Substitutions work by editing the string being matched, but you want the substitutions to work on the string being returned. That doesn't work.

    You could do it with a parser, but Perl 5 regexp are not good enough to form a parser. (Well, it's theoretically possible with experimental regexp features.)