Search code examples
notepad++

Find and replace values in a valueholder in an ini file with notepadd++?


I have an ini file with a repeated value holder called pRecord= and it has a value after it. I want to replace the value with 0 but it can be between 1 and 5 digits.

Example:

pRecord=23
pRecord=223
pRecord=345
pRecord=2234
pRecord=15321

I now want them all to be pRecord= or pRecord=0, but I can't figure out how to to it correctly with the find and replace feature of notepad++.


Solution

    • Ctrl+H
    • Find what: pRecord=\K\d+
    • Replace with: 0
    • CHECK Match case
    • CHECK Wrap around
    • CHECK Regular expression
    • UNCHECK . matches newline
    • Replace all

    Explanation:

    pRecord=        # literally
    \K              # forget all we have seen until this position
    \d+             # 1 or more digit
    

    Screenshot (before):

    enter image description here

    Screenshot (after):

    enter image description here