extended regular expression

The two regular expression dialects of Unix tools: basic (BRE), used by grep and sed by default, and extended (ERE), selected with -E.

In more detail

In basic syntax, repetition counts and grouping need backslashes, as in [0-9]\{2\}; in extended syntax you write [0-9]{2} and (a|b) directly. The matching power is the same, so pick -E for readability.

Examples

grep -E ' [45][0-9]{2} ' access.log
grep ' [45][0-9]\{2\} ' access.log

Related terms

Taught in

References