regex - PHP replace all dots to comma -


this question has answer here:

i have string

10.2, 200.3, 33.00

and want replaced

10,2, 200,3, 33,00

i tried

preg_replace("/[.]$/","/\d[,]$/",$input);

but not replacing!

i can't use str_replace because it's task in university

preg_replace('/\./', ',', $input);  

this replace '.' dots ','.

preg_replace('/(\d+).(\d+)/', '$1,$2', $input);  

this more specific need. $1 replaces first digit in parenthesis; $2 second.

-buy me beer nw ;)


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -