Community
    • Login

    Want REGEX to Check Every Line Indivdually

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    regexlinesdocument
    6 Posts 3 Posters 460 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.
    • kc270000K
      kc270000
      last edited by

      I have Notepad++ document with an email address on each line. I want to replace the ampersand and everything before it, so I am left with just the domain of each email address. When I search with the expression “<[^@]+?@” and replace with blank, the entire document is cleared. How do I get Notepad++ search each line individually?

      Thanks for any ideas on this.

      Alan KilbornA TBugReporterT 2 Replies Last reply Reply Quote 1
      • Alan KilbornA
        Alan Kilborn @kc270000
        last edited by

        @kc270000

        (?-s)^.+?@

        kc270000K 1 Reply Last reply Reply Quote 0
        • TBugReporterT
          TBugReporter @kc270000
          last edited by

          @kc270000 said in Want REGEX to Check Every Line Indivdually:

          the ampersand

          “&”?

          The mind boggles. 😁

          kc270000K 1 Reply Last reply Reply Quote 0
          • kc270000K
            kc270000 @Alan Kilborn
            last edited by

            @Alan-Kilborn

            Thank you for your help on this.

            1 Reply Last reply Reply Quote 1
            • kc270000K
              kc270000 @TBugReporter
              last edited by

              @TBugReporter said in Want REGEX to Check Every Line Indivdually:

              The mind boggles. 😁

              Meant “at” typed ampersand. Thankfully Alan understood…

              Alan KilbornA 1 Reply Last reply Reply Quote 1
              • Alan KilbornA
                Alan Kilborn @kc270000
                last edited by Alan Kilborn

                @kc270000 said in Want REGEX to Check Every Line Indivdually:

                Meant “at” typed ampersand. Thankfully Alan understood…

                Actually I think I glossed over ampersand and my eyes flew right to the non-working regex you provided – and I went from there quickly to the solution.
                :-)

                BTW, (maybe) the reason the OP’s regex cleared the entire document is that the regex didn’t contain anything to limit the match to each line. Typically this is done with (?-s) in combination with .* or .+ later in the expression. Without a ., and without any line-ending characters in the regex, it will match across lines and perhaps even consume the entire doc.

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