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 given pattern. In the case of ModSecurity, regular expressions are used by rules to define when and how the rule matches. Although there are other operators available for use with rules (@streq
, @contains
, @gt
, and others), the regular expression operator is the default one used, which goes to show how important regular expressions are and that knowledge of them is important to being able to fully use ModSecurity.