Regular expression flavors
There are many different "dialects" of regular expressions, each with slightly different nuances and supported constructs. Here are just a few of the different flavors of regex engines available:
Perl
PCRE
POSIX
.NET
Python
Java
As an example of the differences, the Perl regex engine supports character classes such as [:alpha:]
, which denote an alphanumeric character. The Java regex engine, on the other hand does not support this. For a table listing regular expression features and which dialects support them see http://www.regular-expressions.info/refflavors.html.
The regular expression flavor used by Apache, and hence by ModSecurity since they are compiled using the same library, is called Perl-Compatible Regular Expressions (PCRE). This is a library developed by Philip Hazel and used by many open source projects which require regular expression support.
As the name implies, PCRE aims to be compatible with the Perl regular expression engine (which is so tightly integrated into the massive Perl programming language that trying to extract just the regular expression engine into a library would be near impossible). Since ModSecurity uses PCRE, this is the dialect you should be looking up online if you ever have any question about why a regex doesn't work the way you expect it to—it may be that PCRE syntax is different from what you are using.