Regex4 – Subexpressions

Alternatives are defined with the binary OR metacharacter, the pipe |

This will find either bob or sam:

Subexpressions can be defined with parenthesis metacharacters to limit scope

This will find submarine and subclipse:

egrep ‘sub(marine|clipse)’ test.txt

Leave a Reply

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