Page 1 of 1

search and replace data with coma or dot

Posted: Tue Dec 13, 2011 9:26 pm
by michpatr
Hi,

I would like to find the appropriate regex to search and replace in a source code of an html file :

- search simultaneously 12,50 and 12.50
- and replace it simultaneously respectively by (for instance) 12,80 and 12.80


Thank you in advance for any help.

Patrick

Re: search and replace data with comma or dot

Posted: Wed Dec 14, 2011 12:06 am
by Fool4UAnyway
Find:
(\d+)([\.,])(\d+)

Replace by:
$1$280

Would that do?

Perhaps {$1}{$2}80.

You could also use "12[.,](\d+)" and "12$180" or the form that does work...

Re: search and replace data with coma or dot

Posted: Wed Dec 14, 2011 10:05 am
by patrmich
Hi,

Thank you for the prompt reply.

I do not understand how (\d+)([\.,])(\d+) can search specifically for 12.50 and 12,50 ?

Thank you in advance,

Patrick

Re: search and replace 12 50 with comma or dot

Posted: Wed Dec 14, 2011 11:07 pm
by Fool4UAnyway
Specifically 12 50 with comma or dot = "12, then comma or dot, then 50".

Find:
12([\.,])50

Replace by:
12$180

Re: search and replace data with coma or dot

Posted: Fri Dec 16, 2011 4:53 pm
by patrmich
Thank you !

It does work well with Tewt Crawler