I need to match an infinite number of figures in a web page.
I need to be able to match all of the following formats:
100 $
99$
$99
$ 8
$.99
$ .8
$ 99.8
.99$
.99 $
9.2 $
1.2$
And the equivalent using commas:
444,333
22,333
1,222
11,111,111
333,333,333,333.01132
Or spaces:
444 333
22 333
1 222
11 111 111
333 333 333 333.01132
This is a really hard one for me. I am used to playing with regexp but I have totally failed to write something bullet proof. Usually http://www.regexlib.com has the solution, but not for this one.
I can't think of another way other than using regexp since it's a plain text search/replace.