Regex.Spec behaviour (regex_spec v0.21.38)

Provides typed regular expressions for your Elixir application.

Use in your module to define the return type of your regular expression functions.

Link to this section Summary

Callbacks

Returns a boolean indicating whether there was a match or not.

The original compiled Regular Expression.

Runs the regular expression against the given string until the first match. It returns a list with all captures or nil if no match occurred. See Regex.run/3

Runs the regular expression against the given string until the first match. It returns a list of byte index and match length or nil if no match occurred. See Regex.run/3 with [return: :index] option.

Link to this section Callbacks

Specs

match?(s :: binary()) :: bool()

Returns a boolean indicating whether there was a match or not.

See Regex.match?/2

Specs

regex() :: Regex.t()

The original compiled Regular Expression.

Specs

run(s :: binary()) :: nil | [String.t()]

Runs the regular expression against the given string until the first match. It returns a list with all captures or nil if no match occurred. See Regex.run/3

Link to this callback

run_indicies(s)

Specs

run_indicies(s :: binary()) :: nil | [{integer(), integer()}]

Runs the regular expression against the given string until the first match. It returns a list of byte index and match length or nil if no match occurred. See Regex.run/3 with [return: :index] option.