Use Notepad ++ to Change Strings Specified in Regex String


It's possible to run find and replace RegEx searches in Notepad ++ that include the searched for strings in the replacement with new data. So for example, if you have a list of street addresses and you want to add in separators, you can do the following:

1. Press CTRL + H to bring up the find and replace tool and select the Regular Expression mode.

2. Enter this RegEx search in the Find box:

(AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|AS|GU|MP|PR|VI|UM) ([0-9][0-9][0-9][0-9][0-9])

[note the the pipes are 'OR' operators in Regex searches.]

3. In the replace box enter:

~ \1~ \2

4. After you click, Replace All, your data will have tildes in front of the state abbreviations and the zip codes.