Regex Help?
Regular Expressions March 10th, 2009What would be a string to replace:
This is $1.00. Ain't that nice
$1.00 for this stuff.
Buy this now for $1.00
with the format:
$1.00 {rest of the stuff from string}
so the output would be.
$1.00 This is . Ain't that nice
$1.00 for this stuff.
$1.00 Buy this now for
This replace regexp will capture everything before and after the string you care about, and change places of the found groups in the required order:
s/(.+)(\$\d+\.\d\d)(.*)/$2 $1 $3/g