I can never remember the differences in regular expression syntax used by tools like grep and AWK, or languages like Python and PHP. Generally, Perl has the most expansive syntax, but I'm often hamstrung by the limitations of even egrep
("extended" grep
).
Is there a site that lists the differences in a concise and easy-to-read fashion?
Some regexes will compile in two different programming languages, but will have different match behavior. For example, the notation /\Q… \E/ will quote the text in between the \Q and \E in Java, PHP, Go, and Perl, but in JavaScript, Ruby, and Python these symbols will be treated as the literals Q and E.
(dot) Matches any single character, except a new line. Note: Regular expressions in Content Compliance policies are case sensitive. Note: Regular expressions in Content Compliance policies are case sensitive.
Though most regexes compile across language boundaries, 15% exhibit semantic differences across lan- guages and 10% exhibit performance differences across languages. We explained these differences using regex documentation, and further illuminate our findings by investigating regex engine im- plementations.
There are also two types of regular expressions: the "Basic" regular expression, and the "extended" regular expression.
For my own future reference, I'll offer the Regexp Syntax Summary page which contrasts the syntax for grep
, egrep
, Emacs, Perl, Python, and Tcl. As expected, Perl supports the greatest variety of operators, but Python looks equally capable, if not more so.
Mastering Regular Expressions, devotes the last four chapters to Java, PHP, Perl, and .NET. One chapter for each. From what I know, the pocket edition contains just those final four chapters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With