Searching something for automatition
-
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.
-
@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
;
. -
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 theReplace
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
-
-
@guy038 said in Searching something for automatition:
guy038
Hi guy038,
that’s pretty cool.
Thank you very much