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.
    • 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