Hyperscan is a high-performance multiple regex matching library. It follows the regular expression syntax of the commonly-used libpcre library, but is a standalone library with its own C API.
Hyperscan uses hybrid automata techniques to allow simultaneous matching of large numbers (up to tens of thousands) of regular expressions and for the matching of regular expressions across streams of data.
Hyperscan is typically used in a DPI library stack.
Lookarounds often cause confusion to the regex apprentice. I believe this confusion promptly disappears if one simple point is firmly grasped. It is that at the end of a lookahead or a lookbehind, the regex engine hasn't moved on the string. You can chain three more lookaheads after the first, and the regex engine still won't move. In fact, that's a useful technique.
A quick syntax reminder
This page digs deep into the details of lookahead and lookbehind and assumes you've already become familiar with the basic syntax, perhaps by reading the lookaround section of the reference on (? … ) syntax. As a quick reminder before we dive in, here are the four lookarounds.
| Lookaround | Name | What it Does |
|---|---|---|
(?=foo) |
Lookahead | Asserts that what immediately follows the current position in the string is foo |
(?<=foo) |
Lookbehind | Asserts that what immediately precedes the current position in the string is foo |
(?!foo) |
Negative Lookahead | Asserts that what immediately follows the current position in the string is not foo |
(?<!foo) |
Negative Lookbehind | Asserts that what immediately precedes the current position in the string is not foo |