Flavors and features of regular expressions
Also see this document
POSIX Basic Regular Expressions (BRE) |
POSIX Extended Regular Expressions (ERE) |
grep | egrep | Perl Compatible Regular Expressions (PCRE) |
|
---|---|---|---|---|---|
* ^ $ [ ] | Yes | Yes | Yes | Yes | Yes |
? + | | No | Yes | Yes, but need to add \, e.g. \| | Yes | Yes |
Matching/capture groups | Yes: \(...\) | Yes: (...) | Yes: \(...\) | Yes: (...) | Yes: (...) |
{ } | Yes, but need to add \, e.g. \{ \} | Yes | Yes, but need to add \, e.g. \{ \} | Yes | Yes |
\b \B (Word boundaries) |
No | No | No | Yes | Yes |
\w \W (Alphanumeric characters without _) |
No | No | Yes | Yes | Yes (but _ will be matched too) |