Search code examples
pcrebbedit

regex for substituting comma with period in a string of digits


Assuming a string of minimum one digit to the left of the decimal and minimum one to the right

0,0

when replacing the comma for a period, the replace function is not returning a proper result as the period in GREP signifies any character.

What is the proper way to find and replace the comma with a period in such a context?


Solution

  • (\d+)\,(\d+)searches for any number of digits around a comma, while \1\.\2 maintains the two numerical propositions and substitutes the comma with a period.