Elixir’s regex is based on PCRE (Perl Compatible Regular Expressions).
Regex module gives us the following methods:
run runs the regular expression against the given string until the first match.
You can use the
~r/<regex>/. Using the curly brackets version is more convenient as you can match
/forward slash characters without having to escape it.
run several times collecting all matches of the regular expression.
split splits the given target based on the given pattern.
replace takes in a regex, a string and a replacement, returns a new string where all matches are replaced by the replacement.