The regex rule option matches regular expressions against payload data via the hyperscan search engine.

One of the main advantages to using regex options over pcre options is the ability to use regex regular expressions as fast_pattern matches. Doing so, however, requires that the hyperscan libraries are installed and hyperscan is enabled in the Snort 3 Lua configuration like so:

search_engine = { search_method = "hyperscan" } 

Like the pcre option, these regular expressions follow the perl-compatible regular expression (PCRE) syntax, are enclosed in double quotes, and must start and end with forward slashes.

Similar to pcre, regex options are evaluated against any sticky buffer that precedes it.

Regular expressions written for regex options have access to only a limited set of flags/modifiers, and those compatible flags are shown below.


icase insensitive
sinclude newlines in the dot metacharacter
mBy default, a pcre string is treated as one big line of characters, and '^' and '$' match at the beginning and ending of the string. When m is set, '^' and '$' match immediately following or immediately before any newline in the buffer, as well as the very start and very end of the buffer.
Rstart the regex search from the end of the last match instead of start of buffer


# regex gets evaluated against data in the specified sticky buffer