Here is a table helpful for learning regular expression metacharacters differences across several languages and environments.
Language/environment | Optional | More | Brackets | Border | Or | Group |
---|---|---|---|---|---|---|
Apache, Bash, egrep, Java, JS, Perl, PHP, Python, Ruby, VBScript, .NET | ? |
+ |
{,} |
\b |
| |
() |
Gawk, Openffice.org | ? |
+ |
{,} |
\<,\> |
| |
() |
awk, Mawk, Expect | ? |
+ |
N/A | N/A | | |
() |
C, Lex, Tcl | ? |
+ |
{,} |
N/A | | |
() |
Find, Emacs | ? |
+ |
N/A | \b |
\| |
\(\) |
grep, ed | \? |
\+ |
\{,\} |
\b |
\| |
\(\) |
sed | \? |
\+ |
\{,\} |
\<,\> |
\| |
\(\) |
Vim | \= |
\+ |
\{,} |
\<,\> |
\| |
\(\) |
PostgreSQL | ? |
+ |
{,} |
\y |
| |
() |
MySQL | ? |
+ |
{,} |
[[:<:]] |
| |
() |
Oracle | ? |
+ |
{,} |
N/A | | |
() |
Thankfully, .
*
[]
[^]
^
and $
work the same way in all.
The hard work of checking the differences was done by Aurelio Jargas, published in his wonderful book about regular expressions. (Portuguese only)
I merely grouped them by language/environment, chunking the information for easier memorizing.