Appendix B. Regular Expressions

ModSecurity rules rely heavily on regular expressions to allow you to specify when a rule should or shouldn't match. This appendix teaches you the basics of regular expressions so that you can better make use of them when writing ModSecurity rules. Regular expressions are also useful in a number of other areas, including programming, text processing, and Linux administration, so learning about them is definitely worth the investment in time.

What is a regular expression?

A regular expression (often abbreviated as regex or regexp) is a way to identify strings of interest. Regular expressions can be used to search through large amounts of text to find specific strings, or to make sure a particular string matches a ...

Get ModSecurity 2.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.