Verbalex is a library for creating complex regular expressions with the reader & writer in mind.
It does not aim to replace Elixir's already excellent Regex module for operating on regex. Instead, it focuses only on building the ~r/regexes/
themselves.
alias Verbalex, as: Vlx
protocols = ""
|> Vlx.find("http")
|> Vlx.maybe("s")
|> Vlx.then("://")
|> Vlx.capture_as("protocols")
|> Regex.compile!()
# ~r/(?<protocols>(?:http)s?(?::\/\/))/
Regex.named_captures(protocols, "https://github.com/tylerbarker")
# %{"protocols" => "https://"}
def deps do
[
{:verbalex, "~> 0.3.0"}
]
end
Documentation can be found at https://hexdocs.pm/verbalex.
Verbalex is essentially an Elixir port of the popular Verbal Expressions family of libraries, while also taking some inspiration from Simple Regex.
Thanks to Max Szengal for laying down the groundwork in 2013 with ElixirVerbalExpressions.
For issues, comments or feedback please first create an issue.