• I imagine it to be very simple … But I’m new with Notepad ++, I found a difficulty in generating the ER of this situation:

    line 1: | abc | test | def |
    line 2: | abc | nop | bbb |
    line 3: | abc | def | aaa |

    I need the results that have | abc | and | def | on the same line, so you can replace the o | def | for | def1 | only in those initiated by | abc |.
    Thank you!

  • Can’t figure out what you want to replace exactly (from the description) but based on the title and general idea I 'll give an example that you might modify to achieve your real goal:

    I want to find lines starting with abc and change MISTeak later in the line to CORRECTED without changing anything else, using Replace dialog with Regular expresions:

    Find: ^(abc.*)MISTeak

    Replace: $1CORRECTED

    ^ start of line match only
    ( ) parens “capture” whatever is between them, you must write ( or ) if you need to match a real paren
    abc – match literally abc
    .* any characters, as many as are found including NONE.
    MISteak : those literal characters (can be marked case sensitive or not)

    $1 replace what you found in FIRST paren set, if you had () and () the $2 would be 2nd capture etc.

    Save your doc, try it, use undo if you make a mistake and if you seriously foul it up reload the saved doc from disk.

    Weakness (which can be fixed): What if MISTeak appears more than once in the line – there are ways to fix that too.

Log in to reply