Community
    • Login

    Delete text with notepad ++

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 8.3k 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.
    • lolo germL Offline
      lolo germ
      last edited by

      Hi there !, Use notepad ++, I tried to delete text between @ and before “:”, my text is 15678 lines, the text is as follows:

      Landon@mail.com:m1234@mail.com:name1
      Caleb@mac.lt:myr@mail.com:name4
      Gavin@wichi.es:phil@ymail.com:name5

      The result that is needed is:
      Landon:m1234@mail.com:name1
      Caleb:myr@mail.com:name4
      Gavin:phil@ymail.com:name5

      How can I do this?

      1 Reply Last reply Reply Quote -1
      • guy038G Offline
        guy038
        last edited by guy038

        Hello, @lolo-germ and All

        Ok ! Try to be as accurate as possible ! Indeed, you would like to delete any range of characters, between the first arrobas symbol ( @ ) of each line till the nearest colon character : excluded

        As usual, no problem with regular expressions ;-)). So :

        • Open the Replace dialog ( Ctrl + H )

        • Select the Regular expression search mode

        • Tick the Wrap around option

        SEARCH (?-s)@.+(?=:.+@)

        REPLACE Leave EMPTY

        • Click, once, on the Replace All button or several times on the Replace button

        Notes :

        • The (?-s) modifier means that dot ( . ) matches a single standard character, only ( not the EOL of a line-break )

        • Then the part @.+ tries to match an arrobas followed by the longest non-null range of any standard character

        • But, ONLY IF the positive look-ahead structure, (?=......) is TRUE. That is to say if the regex :.+@ is satisfied at the “work position” of the regex engine. In other words, if, right after, a colon character can be found and, further on, a second arrobas character, separated, from the first colon, by a non-null range of chars , .+

        • As the replacement zone is empty, the matched range of characters is just deleted

        Cheers,

        guy038

        1 Reply Last reply Reply Quote 1
        • lolo germL Offline
          lolo germ
          last edited by

          very grateful to you, I’ve tried it and it works

          1 Reply Last reply Reply Quote 0

          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