Regex.compile
You're seeing just the function
compile
, go back to Regex module for more information.
Specs
Compiles the regular expression.
The given options can either be a binary with the characters
representing the same regex options given to the
~r
(see Kernel.sigil_r/2
) sigil, or a list of options, as
expected by the Erlang's :re
module.
It returns {:ok, regex}
in case of success,
{:error, reason}
otherwise.
Examples
iex> Regex.compile("foo")
{:ok, ~r/foo/}
iex> Regex.compile("*foo")
{:error, {'nothing to repeat', 0}}