Below you will find pages that utilize the taxonomy term “regex”
December 9, 2016
Various capture group methods
Just wanted to write one or two of these, maybe more as time goes on:
egrep:
egrep -o "(['\"])root\1" This one I wanted to get either a ‘ or a ” before the word “root” and then find the closing one, whichever it was. The key here is that with egrep you have to surround the statement in quotes, the opening/closing parentheses don’t need escaping, and use a backslash followed by a number to denote the group