• Login
Community
  • Login

How to delete this on notepad?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 3 Posters 527 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.
  • M
    Marcin Tomczak
    last edited by Nov 19, 2021, 6:49 PM

    g.e.n.t.l.e.k.s.dd@gmail.com:444
    t.wo…1122334.455.6.6@gmail.com:333
    thrifty.wife@yahoo.com:222
    cut.3fac.3@yahoo.com:111

    I want to delete every line containing more then 3 dats on email, how to do it?

    So this 2 are good

    thrifty.wife@yahoo.com:222
    cut.3fac.3@yahoo.com:111

    A 2 Replies Last reply Nov 19, 2021, 7:19 PM Reply Quote 0
    • A
      Alan Kilborn @Marcin Tomczak
      last edited by Nov 19, 2021, 7:19 PM

      @marcin-tomczak

      Seems like this would match the lines you don’t want. If you can match them you can delete them by replacing with nothing.

      (?-s)^.*?(\..*?){3}@.*\R

      Use regular expression search mode.

      P 1 Reply Last reply Nov 19, 2021, 7:29 PM Reply Quote 2
      • A
        Alan Kilborn @Marcin Tomczak
        last edited by Alan Kilborn Nov 19, 2021, 7:28 PM Nov 19, 2021, 7:27 PM

        Actually, you said:

        delete every line containing more then 3 dats

        But I gave a solution (above) for “3 or more” dots.

        Here’s the semi-obvious slight adjustment to do “more than 3”:

        (?-s)^.*?(\..*?){4}@.*\R

        M 1 Reply Last reply Nov 19, 2021, 8:23 PM Reply Quote 2
        • P
          PeterJones @Alan Kilborn
          last edited by PeterJones Nov 19, 2021, 7:56 PM Nov 19, 2021, 7:29 PM

          @Marcin-Tomczak ,

          Alan’s second answer should give the results you requested.

          But remember, “be careful what you ask for”: Specifically in this case, be wary of trying to differentiate between spam email and valid email addresses based on number of dots.

          • first.mi.last.modifier@gmail.com is valid; there are a lot of “peter jones”-es on gmail, and many of us use middle initials and/or some other modifier after the last name, breaking your “delete if more than three dots” rule
          • first.mi.last@alumni.collegename.edu is valid: many colleges give alumni addresses on a subdomain

          Anyone who is trying to solve spam by using regex will fail – both by not keeping out enough and by rejecting valid addresses. So if that’s what you’re doing, you might want to go a different direction.,

          ----
          edit: my examples weren’t right, because re-reading the original post, it looks like you only want to match usernames (before the @ sign) that have more than 3 dots… which is different than I interpreted it (more than three dots anywhere in the email address, before or after the @). I am still leaving the post without deleting it because of conversational context, and because the general warning of my post – don’t expect regex to be able to filter out ‘fake’ email addresses – is still valid.

          M 1 Reply Last reply Nov 19, 2021, 7:32 PM Reply Quote 1
          • M
            Marcin Tomczak @PeterJones
            last edited by Nov 19, 2021, 7:32 PM

            @peterjones
            I tried this what u gave me, one mail was deleted but for an example this still survive

            b.eth.2012.bs .@gmail.com:111

            Here we got 4 dats in email and he’s not deleted.

            P 1 Reply Last reply Nov 19, 2021, 7:52 PM Reply Quote 0
            • P
              PeterJones @Marcin Tomczak
              last edited by Nov 19, 2021, 7:52 PM

              @marcin-tomczak ,

              First, @Alan-Kilborn was the one who gave you the expression, not I. He deserves credit.

              And I say credit, not blame, because his expression works on the address you just shared.

              g.e.n.t.l.e.k.s.dd@gmail.com:444
              t.wo…1122334.455.6.6@gmail.com:333
              thrifty.wife@yahoo.com:222
              cut.3fac.3@yahoo.com:111
              b.et.2012.bs.@gmail.com:111
              

              c5271ee8-2b26-4124-8036-c58e804c670b-image.png

              If your expression is not matching that last address, then you have not correctly used Alan’s expression.

              1 Reply Last reply Reply Quote 2
              • M
                Marcin Tomczak @Alan Kilborn
                last edited by Nov 19, 2021, 8:23 PM

                @alan-kilborn
                Thank u Alan for help and your time :)

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