WhiteBread v3.1.0 WhiteBread.RegexExtension
Summary
Functions
Takes a regex and matches it against the string. Returns named groups with atoms as keys
Functions
Takes a regex and matches it against the string. Returns named groups with atoms as keys.
Examples
iex> atom_keyed_named_captures(~r/hello (?<world>[a-z]+)/, "hello earth")
[world: "earth"]
iex> atom_keyed_named_captures(~r/(?<a>[a-z]+) (?<b>[a-z]+)/, "hello earth")
[a: "hello", b: "earth"]
iex> atom_keyed_named_captures(~r/.+/, "hello earth")
[]