Extended regular expressions are used in the awk(1) and egrep(1) utilities. Below are the corresponding metacharacters:
* . ^ $ [ ] \ ? + | ( ) { }
The following list describes several important characteristics of metacharacters used in extended regular expressions:
Sample pattern | Description |
---|---|
dog? | Matches 0 or 1 occurrence of the pattern dog. |
dog+ | Matches 1 or more occurrences of the pattern dog. |
dog1|dog2 | Matches either dog1 or dog2. The pattern hot dog|hamburger matches either hot dog or hamburger. The pattern [Ss]tor(y|ies) matches Story, story, Stories, and stories. |