Search code examples
regexnotepad++

removing specific thousand separator in specific column in notepad++


I have set of numbers format like 1.8789 and would like the output to become 1878.9

These number is inside specific column and have million lines to be update.

I didn't find any similar to solve this. Below is the highlight screenshot.

data set


Solution

  • As far as I understand, you want to change only the last column. Here is a way to go:

    • Ctrl+H
    • Find what: \.(\d{3})(?=\d*$)
    • Replace with: $1.
    • CHECK Wrap around
    • CHECK Regular expression
    • Replace all

    Explanation:

    \.              # a dot
    (\d{3})         # group 1, 3 digits
    (?=             # positive lookahead, make sure we have after:
        \d*             # 0 or more digits
        $               # end of line
    )               # end lookahead
    

    Replacement:

    $1          # content of group 1, 3 digits
    .           # a dot
    

    Screenshot (before):

    enter image description here

    Screenshot (after):

    enter image description here