Regex operations using Rust's RegexSolver
Summary
Functions
Computes the intersecion of two regular expressions
Types
Functions
@spec intersect(Regex.t() | String.t(), Regex.t() | String.t()) :: {:ok, String.t()} | {:error, op_error()}
Computes the intersecion of two regular expressions
Examples
iex> RegexSolver.intersect(~r/[a-z]+/, ~r/abc|def/)
{:ok, "(abc|def)"}
iex> RegexSolver.intersect("[A-Z]+_[A-Z]+", "ENV_[A-Z]+")
{:ok, "ENV_[A-Z]+"}
iex> RegexSolver.intersect(~r/[0-9]+/, ~r/[A-Z][a-z]+/)
{:error, :empty_intersection}
iex> RegexSolver.intersect("a|b", "b")
{:ok, "b"}
iex> RegexSolver.intersect("a)", "a|b|c")
{:error, "invalid regex: a)"}