Community
    • Login

    How to delete this on notepad?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 3 Posters 496 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.
    • Marcin TomczakM
      Marcin Tomczak
      last edited by

      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

      Alan KilbornA 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Marcin Tomczak
        last edited by

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

        PeterJonesP 1 Reply Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn @Marcin Tomczak
          last edited by Alan Kilborn

          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

          Marcin TomczakM 1 Reply Last reply Reply Quote 2
          • PeterJonesP
            PeterJones @Alan Kilborn
            last edited by PeterJones

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

            Marcin TomczakM 1 Reply Last reply Reply Quote 1
            • Marcin TomczakM
              Marcin Tomczak @PeterJones
              last edited by

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

              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Marcin Tomczak
                last edited by

                @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
                • Marcin TomczakM
                  Marcin Tomczak @Alan Kilborn
                  last edited by

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

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