My notes on Notepad++ Regular Expressions

It’s my notes on some regular expressions in Notepad++. I will add more as I go through.

Keep the text between brackets [ and ] and remove all other texts (useful to keep only hostnames in ansible output). 

Find what: ^.*\[(.*?)\].*$

Replace with: /1

Replace last space with dot (.) in notepad++

Find what: (\S+)$

Replace with: .$1

Replace new line (\n) with backspace and comma (,) (useful to limit hosts in executing ansible tower templates)

Find what: \r\n
Replace with: ,

Find all non-ASCII characters

Find what: [^\x00-\x7F]

Find all users as rcpt from default frontend connector of Exchange Server Log (need to change green color with your actual default frontend connector name)

Default Frontend <Your CAS Server Name>.+rcpt to:<\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

For the example.com domain, you can scope down the above command to this:

Default Frontend <Your CAS Server Name>.+rcpt to:<\b[A-Z0-9._%+-][email protected]>,

Find all email users as rcpt from smtp connector

 <Your CAS Server Name>\\smtp.+rcpt to:<\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

For the example.com domain, you can scope down the above command to this:

 <Your CAS Server Name>\\smtp.+rcpt to:<\b[A-Z0-9._%+-][email protected]>,

Find all recipients from specified mailbox server [here: 172.1.1.1]

 <Your CAS Server Name>\\smtp.+.172.1.1.1.+rcpt to:<\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

Leave a Reply

Your email address will not be published. Required fields are marked *