Community
    • Login

    TWO RESULTS IN A SAME LINE

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 834 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Luciano ZanardiL
      Luciano Zanardi
      last edited by

      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!

      1 Reply Last reply Reply Quote -1
      • Herb MartinH
        Herb Martin
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors