• Login
Community
  • Login

Searching something for automatition

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 440 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.
  • H
    Holger Hasenmüller
    last edited by Holger Hasenmüller Feb 1, 2022, 7:31 AM Feb 1, 2022, 7:31 AM

    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.

    N 1 Reply Last reply Feb 1, 2022, 9:34 AM Reply Quote 0
    • N
      Neil Schipper @Holger Hasenmüller
      last edited by Feb 1, 2022, 9:34 AM

      @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
      • G
        guy038
        last edited by guy038 Feb 1, 2022, 10:08 AM Feb 1, 2022, 10:04 AM

        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

        H 1 Reply Last reply Feb 1, 2022, 12:34 PM Reply Quote 1
        • H
          Holger Hasenmüller @guy038
          last edited by Feb 1, 2022, 12:34 PM

          @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
          2 out of 4
          • First post
            2/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors