NAME

Hyperscan::Matcher - high level matcher class

VERSION

version 0.03

CONSTRUCTORS

new( \@specs, %args )

Construct a new matcher object using the @specs provided.

Accepts the following named arguments:

default_flags

Flags that will be applied to all patterns, default: HS_FLAG_SOM_LEFTMOST.

literal

Whether the specs provided should be compiled literally.

mode

The underlying hyperscan mode to use, default: "block".

Specs

A spec can take a few forms

String

The string is used as the pattern, the flags are the default flags and the id is the index in the list.

Regex

A perl Regex object is broken down into it's pattern and flags. The flags are combined with the default flags and the id is the index in the list.

Array

The first item is shifted and uses the String or Regex behaviour above. If the item is a string an additional item is shifted to be used as the flags. The next elements in the array are taken to be the id and the ext hash.

Hash

A hash with the following keys

expr

A String or Regex.

flag

Flags, ignored if a Regex is uses as the expr.

id

Explicit match ID.

ext

An ext hash.

METHODS

scan( $data, %args )

Scan the data for matches and return any results.

Accepts the following named arguments:

flags

Flags to pass down into hyperscan.

max_matches

Limit the number of matches found while scanning.

reset( $flags )

Resets the current stream and returns any remaining matches, for example matches that contain a $.

AUTHOR

Mark Sikora <marknsikora@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Mark Sikora.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.