I have a issue with regex pattern. It replace not only "," but also all characters that are before.
I would like to replace first occurrence of the "," to ".":
"1,,000.23" -> "1.,000.23"
This pattern I am using now :
^(.*?),
Result that I receive is :
"1,,000.23" -> ".,000.23"
Expected result :
"1,,000.23" -> "1.,000.23"
Maybe you could use ^([^,]+),
and replace with $1.
This will capture from the beginning of the string ^
not a comma in a group ([^,]+)
and then match a comma ,
Use ^(.*?),
and replace it with $1.
. This means:
group as less as possible things from line start till first , into group 1
then match a `,`
and replace it with the captured text of group 1 `$1` and a dot `.`
Copy the capture group to the result. Replace
^(.*?),
with
$1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.