How to Regex append or prepend to lines in Notepad++ and Sublime Text
This is one of the most common tasks that come up when editing code. For both text editors the syntax is almost the same.
For both you would initiate the Search/Replace function and enable Regex for Search/Replace.
In the search field enter :
^(.+)$
This will select all lines individually in the file
In the replace field for Sublime Text enter:
cookie$1monster
This will prepend “cookie” to the beginning of each line and append monster to the end of each line
In the replace field for Notepad++ enter:
cookie\1monster
This will prepend “cookie” to the beginning of each line and append monster to the end of each line
That’s it. Some pretty pictures below to go along with the text madness.