.. _config_hyperscan: Hyperscan ========= * :ref:`Matcher v3 API reference ` * :ref:`Regex engine v3 API reference ` `Hyperscan `_ is a high-performance multiple regex matching library, which uses hybrid automata techniques to allow simultaneous matching of large numbers of regular expressions and for the matching of regular expressions across streams of data. Hyperscan supports the `pattern syntax `_ used by PCRE. Hyperscan is only valid in the :ref:`contrib image `. Hyperscan can be used as a matcher of :ref:`generic matching `, or enabled as a regex engine globally. As a matcher of generic matching -------------------------------- Generic matching has been implemented in a few of components and extensions in Envoy, including :ref:`filter chain matcher `, :ref:`route matcher ` and :ref:`RBAC matcher `. Hyperscan matcher can be used in generic matcher as a custom matcher in the following structure: .. literalinclude:: _include/hyperscan_matcher.yaml :language: yaml :linenos: :lines: 30-35 :caption: :download:`hyperscan_matcher.yaml <_include/hyperscan_matcher.yaml>` The behavior of regex matching in Hyperscan matchers can be configured, please refer to the :ref:`API reference `. Hyperscan matcher also supports multiple pattern matching which allows matches to be reported for several patterns simultaneously. Multiple pattern matching can be turned on in the following structure: .. literalinclude:: _include/hyperscan_matcher_multiple.yaml :language: yaml :linenos: :lines: 30-45 :emphasize-lines: 8-16 :caption: :download:`hyperscan_matcher_multiple.yaml <_include/hyperscan_matcher_multiple.yaml>` As a regex engine ----------------- Hyperscan regex engine acts in the similar behavior with the default regex engine Google RE2 like it turns on UTF-8 support by default. Hyperscan regex engine can be easily configured with the following configuration. .. literalinclude:: _include/hyperscan_regex_engine.yaml :language: yaml :linenos: :lines: 45-48 :caption: :download:`hyperscan_regex_engine.yaml <_include/hyperscan_regex_engine.yaml>`