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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -