Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ModSecurity 2.5

You're reading from   ModSecurity 2.5 Prevent web application hacking with this easy to use guide

Arrow left icon
Product type Paperback
Published in Nov 2009
Publisher Packt
ISBN-13 9781847194749
Length 280 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (17) Chapters Close

ModSecurity 2.5
Credits
About the Author
About the Reviewers
1. Preface
1. Installation and Configuration FREE CHAPTER 2. Writing Rules 3. Performance 4. Audit Logging 5. Virtual Patching 6. Blocking Common Attacks 7. Chroot Jails 8. REMO 9. Protecting a Web Application Directives and Variables Regular Expressions Index

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.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image