Wednesday 23 November 2016

Notepad++ Extended Find and Replace

This tip is actually from Superuser.com - its a handy hint I have used many times to reformat large amounts of user data from various systems into a format I can then utilise universally - so I have published it here for reference:


Consider the scenario where you have a specific string that you want to find-and-replace. You want to replace it with a new string that contains a newline character (or character sequence).
abc123 xyz456-blah
fsafd23 xyz456-green
89hjkf23 xyz456-red
afdsa23 xyz456-yellow
abaac123 xyz456-orange
In the scenario above, I'd like to find " xyz" and replace the space with a carriage return/newline.
The results would look like:
abc123
xyz456-blah
fsafd23
xyz456-green
89hjkf23
xyz456-red

Search string:
 xyz
Note the space in front of xyz.
Replace string:
\r\nxyz
You will also need to set the "Search Mode" to "Extended" so that Notepad++ honors escape codes.