Community
    • Login

    Searching something for automatition

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 854 Views 2 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.
    • Holger HasenmüllerH Offline
      Holger Hasenmüller
      last edited by Holger Hasenmüller

      Fellow Notepad++ Users,

      Could you please help me the the following search-and-replace problem I am having?

      DESCRIBE CIRCUMSTANCES OF YOUR QUESTION

      Here is the data I currently have (“before” data):

      lala.bubu@email.com
      peter.sillie@email.com
      hans.klammer@email.com
      

      Here is how I would like that data to look (“after” data):

      lala.bubu@email.com;peter.sillie@email.com;hans.klammer@email.com
      

      To accomplish this, I have tried using the following Find/Replace expressions and settings

      Find What = `.com`
      Replace With = `.com;`
      Search Mode = NORMAL
      

      I am looking for a way (similar to Autoit) to automate certain things in Notepad++. Like a macro recording. Using Notepad++ I could search and replace .com with .com; but then after that I am using the keyboard to hit the end key and then the delete key to make the 2nd line come up to the first line and so on. How can I solve this?

      Unfortunately, this did not produce the output I desired, and I’m not sure why. Could you please help me understand what went wrong and help me find the solution?

      Thank you.

      Neil SchipperN 1 Reply Last reply Reply Quote 0
      • Neil SchipperN Offline
        Neil Schipper @Holger Hasenmüller
        last edited by

        @holger-hasenmüller said in Searching something for automatition:

        Like a macro recording. Using Notepad++ I could search and replace .com with .com; but then after that I am using the keyboard to hit the end key and then the delete key to make the 2nd line come up to the first line and so on. How can I solve this?

        You are super close to solving your own problem without fancy F&R techniques.

        Do at least one simple normal Find of .com as you already did (to “load” the Find “machinery”). Dismiss the Find dialog and press F3 a few times and observe it working.

        Now cursor to file home (or to start of first line with an email address).

        Start macro recording.
        <F3><END>;<Del>
        End macro recording.

        Now run the macro a few times with Ctl-Shift-p to confirm operation is as expected. Then you can run it Multiple Times... using suitable options for your need.

        If you’d also like to experience use of a sophisticated F&R technique, take a look at this post. It shows how to join adjacent non-empty lines into single lines using a Regular Expression F&R, which is what you want except that, to meet your need, instead of replacing each newline with nothing, you would replace with ;.

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

          Hello, @holger-hasenmüller, @neil-schipper and All,

          @holger-hasenmüller, a quick solution is possible using the Regular expression search mode :

          • Open the Replace dialog ( Ctrl + H )

            • SEARCH (?-s)@[a-z]+\.[a-z]+\K\R(?=.)

            • REPLACE ;

            • Tick the Wrap around option

            • Select the Regular expression serach mode

            • Click, once, on the Replace All button ( Do not use the Replace button ! )

          • Hit the Esc key to close the Replace dialog


          So, for instance, from this INPUT text :

          Start of text
          Yeaaaaah !
          
          lala.bubu@email.com
          peter.sillie@email.com
          hans.klammer@email.com
          
          
          blah blah
          bla bla
          
          This is a test
          OK
          
          
          lala.bubu@email.net
          peter.sillie@email.gov
          hans.klammer@email.fr
          
          End of text
          

          you would get the OUTPUT text below :

          Start of text
          Yeaaaaah !
          
          lala.bubu@email.com;peter.sillie@email.com;hans.klammer@email.com
          
          
          blah blah
          bla bla
          
          This is a test
          OK
          
          
          lala.bubu@email.net;peter.sillie@email.gov;hans.klammer@email.fr
          
          End of text
          

          Best Regards,

          guy038

          Holger HasenmüllerH 1 Reply Last reply Reply Quote 1
          • Holger HasenmüllerH Offline
            Holger Hasenmüller @guy038
            last edited by

            @guy038 said in Searching something for automatition:

            guy038

            Hi guy038,

            that’s pretty cool.

            Thank you very much

            1 Reply Last reply Reply Quote 1

            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