Search code examples
regexnotepad++

Find dot and replace with coma on decimal numbers (Notepad++ RegEx)


I would like to replace dot with comas on numbers: ;;;559.34; to ;;;559,34; for example.

I need to use regex, because there are lots of other numbers using dots (date, time and others), but the one I need to replace always starts with ;;; and ends with ; like non other.

I was able to find those numbers using ;;;\d+.[0-9]{2}; but I can't replace all dots using this.

Thank you.


Solution

  • In notepad++ you can use

    ;;;\d+\K\.(?=[0-9]{2};)
    

    Explanation

    • ;;;\d+ Match ;;; and 1+ digits
    • \K\. Forget what is matched so far
    • (?=[0-9]{2};) Positive lookahead, assert 2 digits and ; at the right

    In the replacement use a comma.

    Regex demo

    enter image description here