php - How can I target < and > with regex? -


i'm working badly designed system i'm trying import orders opencart to. problem lies in not accept float values float, ie. dot, requires comma, means <rowunitprice>6.4516</rowunitprice> must converted <rowunitprice>6,4516</rowunitprice>. have managed following regex:

/(?<=\d)\.(?=d)/

this created problem, however. there product had product code, matched , got replaced. <rowarticlecode>cla713/1.5</rowarticlecode> became <rowarticlecode>cla713/1,5</rowarticlecode>. modified regex following:

/(?<=[>\d])\.(?=[\d<])/

the intention match example >000.000<, problematic article code still gets matched , replaced , don't know why. not getting here?

try with:

/(?<=\>)(\d+)\.(\d+)(?=\<)/g 

and can use substitution captured groups: $1,$2 demo


Comments