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):
firstname.lastname@example.org email@example.com firstname.lastname@example.org
Here is how I would like that data to look (“after” data):
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?
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
.comas 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.
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
@holger-hasenmüller, a quick solution is possible using the
Regular expressionsearch mode :
Open the Replace dialog (
Ctrl + H)
Regular expressionserach mode
Click, once, on the
Replace Allbutton ( Do not use the
Replacebutton ! )
Esckey to close the Replace dialog
So, for instance, from this INPUT text :
Start of text Yeaaaaah ! email@example.com firstname.lastname@example.org email@example.com blah blah bla bla This is a test OK firstname.lastname@example.org email@example.com firstname.lastname@example.org End of text
you would get the OUTPUT text below :
Start of text Yeaaaaah ! email@example.com;firstname.lastname@example.org;email@example.com blah blah bla bla This is a test OK firstname.lastname@example.org;email@example.com;firstname.lastname@example.org End of text