Community
    • Login

    How to find each lines that has upto 3 numbers in a list of email list

    Scheduled Pinned Locked Moved General Discussion
    17 Posts 6 Posters 1.2k 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.
    • PeterJonesP
      PeterJones @Michael Vincent
      last edited by PeterJones

      Unfortunately, there are actually a lot of edge cases, that would make the Dec 2020 solution probably not work (because a1b2@example.com then5 might match as a whole if the .* portion of the solution from 2020 were used, because even though the space means that then5 isn’t part of the email, it would still match that pattern).

      There is also a lack of clarity in the OP’s requirements:

      herbert200@nelkerson23.com
      keneth33faith244@gmail.com
      magret28@doirana1.com
      bethel02chruchhill4@gmail.com
      

      Based on original problem statement, I am not sure whether the first and second should match or not: they seemed to be used by the OP as an example of something that did match, but I’m not sure if they should match, since they violate the “up to 3” since they each have a total of 5 digits.

      I came up with a possible solution (with caveats). If the OP is really a person, and not an AI that is using our forum as a training ground, they should be able to find the right menu entry in Notepad++ to decode this base64 answer

      RklORCA9IGAoPzpefCx8XHN8InwnKVxLKD89XFMrQFxTKykoW15cZFxzXSpcZCl7MSwzfVteXGRcc10rKD89JHwsfFxzfCJ8JylgDQoNCkkgYWRkZWQgcmVzdHJpY3Rpb25zIHRoYXQgYmVmb3JlIGFuIGVtYWlsIGhhZCB0byBiZSBlaXRoZXIgYSBzdGFydC1vZi1saW5lIG9yIGEgY29tbWEgb3Igd2hpdGVzcGFjZSBvciBzaW5nbGUvZG91YmxlIHF1b3RlIG1hcmssIGFuZCBhZnRlciB0aGUgZW1haWwgaGFkIHRvIGJlIGVpdGhlciBFT0wgb3IgY29tbWEgb3Igd2hpdGVzcGFjZSBvciBzaW5nbGUvZG91YmxlIHF1b3RlIG1hcmsgb3IgRU9GLiAgWW91IG1pZ2h0IGhhdmUgb3RoZXIgYWxsb3dlZCBjaGFyYWN0ZXJzIHRoYXQgeW91IGNhbiBhZGQgdG8gdGhvc2UgKG1heWJlIGFsbG93aW5nIGA8ZW1haWwxMjNAZXhhbXBsZS5jb20+YCBvciBgPG1haWx0bzplbWFpbDEyM0BleGFtcGxlLmNvbT5gIHRocm91Z2ggYSBwcmVmaXggb2YgYDxgIG9yIGA6YCBhbmQgYSBzdWZmaXggb2YgYD5gIGFkZGVkIHRvIHRoZSBhbHRlcm5hdGlvbiBsaXN0KQ0K
      

      ----

      Useful References

      • Please Read Before Posting
      • Template for Search/Replace Questions
      • Formatting Forum Posts
      • Notepad++ Online User Manual: Searching/Regex
      • FAQ: Where to find other regular expressions (regex) documentation
      Lycan ThropeL Mendella ReplacementM 3 Replies Last reply Reply Quote 1
      • Lycan ThropeL
        Lycan Thrope @PeterJones
        last edited by

        @PeterJones ,
        Unfortunately, I’ve never played with base64.:( So I guess I’ll have to find this magical mythical tool of which you speak. :) I have my own somewhat solution, but until I find out if it matches yours, I’ll hold still. :)

        1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by guy038

          Hello, @mendella-replacement, @michael-vincent, @alan-kilborn, @lycan-thrope, @peterjones and All,

          @mendella-replacement, as you said :

          … to figure out any line in the document that has up-to 3 numbers in each email addresses …

          I assume that you would like to mark :

          • E-mail addresses containing 3 digits ONLY

          OR

          • E-mail addresses containing 2 digits ONLY

          OR

          • E-mail addresses containing 1 digit ONLY

          OR

          • E-mail addresses containing 0 digit

          If so, and given this INPUT text :

          abcd@gmail.com
          herbert200@nelkerson23.com
          magret28@doirana1.com
          bethel0chruchhill24@gmail.com
          abc1def2ghi3@gmail.com
          123_no_good_adr_456789@toto.com
          test12@hotmail.com
          guy.123@mysite.com
          keneth3faith244@gmail.com
          adr_0_till_9.@gmail.com
          guy0thevenot@gmail.com
          

          Follow this road map :

          • Open the Mark dialog ( Ctrl+ M )

          • SEARCH (?x) ^ [^\d\r\n]* (?: \d [^\d\r\n]* \d [^\d\r\n]* \d | \d [^\d\r\n]* \d | \d ) [^\d\r\n]* $ | ^ [^\d\r\n]+ $

          • Untick all the box options

          • Tick the Purge for each search and Wrap around options

          • Select the Regular expression search mode

          • Click on the Mark All button

          • Click on the Copy Marked Text button

          • Close the Mark dialog ( Esc )

          • Open a new tab ( Ctrl + N )

          • Paste the copied lines ( Ctrl + V ) in this new tab

          => You should get this expected OUTPUT text, which contain not more than 3 digits per line :

          abcd@gmail.com
          magret28@doirana1.com
          bethel0chruchhill24@gmail.com
          abc1def2ghi3@gmail.com
          test12@hotmail.com
          guy.123@mysite.com
          adr_0_till_9.@gmail.com
          guy0thevenot@gmail.com
          

          In order to visualize all these concerned digits of this new tab :

          • Open again the Mark dialog ( Ctrl + M )

          • SEARCH \d+

          • Untick all the box options

          • Tick the Purge for each search and Wrap around options

          • Select the Regular expression search mode

          • Click on the Mark All button

          As you can see, any e-mail address, in this new tab, contains between 0 and 3 digits only, which are all marked !

          Best Regards,

          guy038

          1 Reply Last reply Reply Quote 2
          • Michael VincentM
            Michael Vincent @Lycan Thrope
            last edited by

            @Lycan-Thrope said in How to find each lines that has upto 3 numbers in a list of email list:

            Which I’d rather see the OP try

            That was entirely my point of posting the ChatGPT interaction. There are plenty of resources online - and they’re getting even easier to use - that one can test and show their work before coming here and asking for a solution.

            Cheers.

            Lycan ThropeL 1 Reply Last reply Reply Quote 2
            • Lycan ThropeL
              Lycan Thrope @PeterJones
              last edited by

              @PeterJones ,
              Well, I learned something new. I guess I can start using NPP to see what all those base64 things are. :)

              Anyway, your solution seemed to be erred, but I’m not sure if mine is completely fulfilling the desired result, as all it does is highlight the numbers, and leaves the counting to the OP. :)

              In my newly learned trick of NPP, I guess my answer shall go here the same way yours does. :)

              XGR7MX0r
              
              PeterJonesP 1 Reply Last reply Reply Quote 0
              • Lycan ThropeL
                Lycan Thrope @Michael Vincent
                last edited by

                @Michael-Vincent
                As you can tell, typed sarcasm, although I obviously got your point, isn’t my strong suit. :) LOL However, your point was not lost on my lack of ability to sense sarcasm in the typed word. :)

                1 Reply Last reply Reply Quote 0
                • Michael VincentM
                  Michael Vincent @Alan Kilborn
                  last edited by

                  @Alan-Kilborn said in How to find each lines that has upto 3 numbers in a list of email list:

                  Michael Vincent failure in the problem statement: OP wants “up to 3”, not “at least 3”.

                  Yeah, my bad, I didn’t read the exact question into ChatGPT. The point being though that the OP could have done so and showed some work / effort before asking for solution. I sometimes feel like this forum has become a regex writing service when plenty exist online and if one is too “scared” or “confused” where to start - simply speak your requirement into ChatGPT and get something to start with. It’s really never been simpler to show some effort by our posters (not directed the forum “regulars” who answer these questions again and again … and again …).

                  Cheers.

                  1 Reply Last reply Reply Quote 3
                  • PeterJonesP
                    PeterJones @Lycan Thrope
                    last edited by PeterJones

                    @Lycan-Thrope said in How to find each lines that has upto 3 numbers in a list of email list:

                    In my newly learned trick of NPP, I guess my answer shall go here the same way yours does. :)
                    XGR7MX0r

                    That solution requires the digits to be in a row. And will allow for any number of digits, not limiting it to “up to 3”. (See what happens when you use that against the text 1234567890, and see how much of that text it gobbles in a single match). Also, it will only match the digits, not the entire email address.

                    (Actually, re-reading the OP, it might require that the email is alone on the line, with 0-3 numbers. It’s hard to tell, because the OP didn’t put enough detail in the problem statement, and has never come back to clarify. Until they do, I will stop thinking about this problem.)

                    Lycan ThropeL 1 Reply Last reply Reply Quote 1
                    • Lycan ThropeL
                      Lycan Thrope @PeterJones
                      last edited by Lycan Thrope

                      @PeterJones Yes, I noticed after playing a little more, it gets all numbers, but then again, the OP didn’t specify that it only show the ones with up to 3, only that it wants to determine for them to mark that it has up to 3… my solution was just to show only the numbers and let them count them, but they are marked that they have numbers. :)

                      I have to add though, it is something I’m going to play around with, as this will give me something to use should the issue arise. :)

                      PeterJonesP 1 Reply Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @Lycan Thrope
                        last edited by

                        @Lycan-Thrope said in How to find each lines that has upto 3 numbers in a list of email list:

                        OP didn’t specify that it only show the ones with up to 3

                        Um, the title literally says, “How to find each lines that has upto 3 numbers in a list of email”. How is that not asking for “up to 3”?

                        Lycan ThropeL 1 Reply Last reply Reply Quote 1
                        • Lycan ThropeL
                          Lycan Thrope @PeterJones
                          last edited by Lycan Thrope

                          @PeterJones ,

                          Later in the description:

                          Now, I want to be able to figure out any line in the document that has up-to 3 numbers in each email addresses and able to mark them out. That is checking from beginning to the end of each line and be able to determine how many numbers in the email.

                          According to their test, they used \d{3} but it only showed 3 numbers together. Mine shows them all, so they can make that determination of whether to mark it or not. Semantics at work again. :) But according to the test they show and the wording of their request after the title statement, this solution seems to follow what they later explain they meant.

                          Edit: I have got to figure out this markdown to figure out how to put quotes in where I want them. So I used code for this quote…sorry. @Alan-Kilborn showed me how…now where is that manual. :) Found references from the FAQ and then followed links. Will be better formatter now. :)

                          1 Reply Last reply Reply Quote 0
                          • Mendella ReplacementM
                            Mendella Replacement @Mendella Replacement
                            last edited by

                            @Mendella-Replacement Thank you so much. I’m sorry, I seem to have failed a lot of rules here. I’m new here, not really a coder, lol.
                            I was only trying to fix this error for my manager in the office.
                            I have read your suggestions, I will try them out and report back.

                            1 Reply Last reply Reply Quote 0
                            • Mendella ReplacementM
                              Mendella Replacement @PeterJones
                              last edited by

                              @PeterJones Thank you sir, I will do that before posting here next time.

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