32. What Tools Support What?
| Feature |
awk |
grep |
egrep |
Perl |
vi |
GNU Emacs |
Tcl |
| * ^ $ [...] |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
| ? + | |
? + | |
\? \+ \| |
? + | |
? + | |
\? \+ No |
? + \| |
? + | |
| Grouping |
( ) |
\( \) |
( ) |
( ) |
\( \) |
\( \) |
( ) |
| Word Boundaries |
No |
No |
\< \> |
\b \B |
\< \> |
\< \> and \b \B |
No |
| \w, \W |
No |
No |
Yes |
Yes |
No |
Yes |
No |
| Backreferences |
No |
Yes |
No |
Yes |
Yes |
Yes |
No |
Source: Mastering Regular Expressions, Jeffrey E. F. Friedl, O'Reilly, 1997
- Of course, this isn't all there is to it. Remember when I had to use egrep instead of grep,
because while grep supports + and intervals, it doesn't support them on groups?
- What about nesting groups? What does dot match for this tool? Can we use escapes for
octal or hex numbers? Are shortcuts like \d provided? What does \w match if it is
provided?
- These will all need to be considered when using your regex tool. So be careful! (Or, as is more
likely, keep it in the back of your mind so that when things go pear-shaped, you've got a
starting point to figure out why.)
|