From quine's wiki

Main: RegularExpressions

(See also RegExp.)

Modify all lines that have a third column starting with 'Y' to 'R', where columns are defined by tabs, and do the replacement at most once per line.

1,$s/\(^[^ ]* [^ ]* \)'Y'/\1'R'/

Match all locations in a number where a comma should be placed.

(?<=\\d)(?=(\\d\\d\\d)+$) $num =~ s/(?<=\\d)(?=(\\d\\d\\d)+$)/,/g;

Retrieved from http://quine.ca/wiki/pmwiki.php?n=Main.RegularExpressions
Page last modified on February 19, 2014, at 08:33 PM