Regex helpers

I need help remembering what regex’s do what for me and instead of re-learning them over and over, I thought I would post the most useful ones. I do a lot of ‘Search and replace’ with config files so these are pretty specific.

Sometimes I need to just find the interfaces. (The can easily be filtered in IOS, but I tend to run multiple regex’s in my text editor)

regex1

 

 

 

 

 

 

Another common scenario is cleaning up access lists. For example in an ASA you get a bunch of stuff at the end. A little regex will take care of that.

regex2

When migrating from an old ASA to the new ASA-X, migrating the ACL’s can be a bear. One of the easiest ways to migrate is to grab the access lists that only have hit counts

Then take that list, use Find and enter the regex below and Replace with a blank.

That will remove all the unnecessary areas and you will be left with just an ACL that you can copy-n-paste into the new ASA.