Community
    • Login

    Want REGEX to Check Every Line Indivdually

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    regexlinesdocument
    6 Posts 3 Posters 961 Views 1 Watching
    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 Offline
      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 Offline
        Alan Kilborn @kc270000
        last edited by

        @kc270000

        (?-s)^.+?@

        kc270000K 1 Reply Last reply Reply Quote 0
        • TBugReporterT Offline
          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 Offline
            kc270000 @Alan Kilborn
            last edited by

            @Alan-Kilborn

            Thank you for your help on this.

            1 Reply Last reply Reply Quote 1
            • kc270000K Offline
              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 Offline
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors