Search code examples
replacenotepad++notepadreplaceall

NOTEPAD++ Change line with variable inside


How to change big file like

GSKPP / 3520767 / 1 / 30300

to

GSKPP / 1 / 30300

if 3520767 is variable?

EDIT:


Solution

  • Here is a way to go:

    • Ctrl+H
    • Find what: ^.*?\K/\s+[a-z]?\d+
    • Replace with: EMPTY
    • Replace all

    Explanation:

    ^           : begining of line
    .*?         : 0 or more any character, not greedy
    \K          : forget all we have seen until now
    /           : slash
    \s+         : 1 or more space
    [a-z]?      : an optional letter
    \d+         : 1 or more digits