Hyperscan (hyperscan v0.1.0)

Summary

Functions

Allocate a scratch memory buffer for use by when running the regular expression.

Compile a regular expression into a database.

Compile a regular expression into a database.

Returns a map with debugging info about a regular expression.

Returns the integer value of the flag constant with the given name. Names follow the pattern HSFLAG*. The value is used by the compile and compile_multi functions. To use multiple flags simultaneously, combine their values with Bitwise.bor/2.

Test whether the given compiled regex matches a string. Requires a scratch buffer allocated by alloc_scratch/1.

Test whether multiple compiled regexes match a string. The regex should be compiled by compile_multi. Returns a list of expression IDs that matched the string. Note that the order of the returned IDs is undefined.

Returns the integer value of the mode constant with the given name. Names follow the pattern HSMODE*.

Re-allocate a scratch memory buffer. If the scratch was allocated for a different database and is too small for the given one, it will be reallocated. Returns :ok.

Returns true if the current system architecture supports , otherwise false.

Returns the compiled version of , as a string.

Functions

Link to this function

alloc_scratch(db)

Allocate a scratch memory buffer for use by when running the regular expression.

Link to this function

clone_scratch(scratch)

Link to this function

compile(expression, flags, mode, platform)

Compile a regular expression into a database.

  • expression is a regular expression, without the leading/trailing / characters or flags.
  • flags is an integer. Use 0 for no flags, or bitwise-or together one or more results of the flags/1 function.
  • mode is an integer similar to flags.
  • platform. Either the result of populate_platform or nil.

See the docs for more information: http://intel.github.io/hyperscan/dev-reference/api_files.html#c.hs_compile

Link to this function

compile_multi(expression_list, flags_list, id_list, mode, platform)

Compile a regular expression into a database.

  • expression is a regular expression, without the leading/trailing / characters or flags.
  • flags is an integer. Use 0 for no flags, or bitwise-or together one or more results of the flags/1 function.
  • mode is an integer similar to flags.
  • platform. Either the result of populate_platform or nil.

See the docs for more information: http://intel.github.io/hyperscan/dev-reference/api_files.html#c.hs_compile

Link to this function

expression_info(expression, flags)

Returns a map with debugging info about a regular expression.

Returns the integer value of the flag constant with the given name. Names follow the pattern HSFLAG*. The value is used by the compile and compile_multi functions. To use multiple flags simultaneously, combine their values with Bitwise.bor/2.

Raises :badarg if it is not a valid flag name.

Link to this function

match(db, string, scratch)

Test whether the given compiled regex matches a string. Requires a scratch buffer allocated by alloc_scratch/1.

Link to this function

match_multi(db, string, scratch)

Test whether multiple compiled regexes match a string. The regex should be compiled by compile_multi. Returns a list of expression IDs that matched the string. Note that the order of the returned IDs is undefined.

Returns the integer value of the mode constant with the given name. Names follow the pattern HSMODE*.

Raises :badarg if it is not a valid mode name.

Link to this function

realloc_scratch(db, scratch)

Re-allocate a scratch memory buffer. If the scratch was allocated for a different database and is too small for the given one, it will be reallocated. Returns :ok.

Link to this function

scratch_size(scratch)

Link to this function

valid_platform()

Returns true if the current system architecture supports , otherwise false.

Returns the compiled version of , as a string.