WhiteBread v2.8.1 WhiteBread.RegexExtension

Summary

Functions

Takes a regex and matches it against the string. Returns named groups with atoms as keys

Functions

atom_keyed_named_captures(regex, string)

Takes a regex and matches it against the string. Returns named groups with atoms as keys.

Examples

iex> atom_keyed_named_captures(~r/hello (?[a-z]+)/, “hello earth”) [world: "earth"]

iex> atom_keyed_named_captures(~r/(?[a-z]+) (?[a-z]+)/, “hello earth”) [a: "hello", b: "earth"]

iex> atom_keyed_named_captures(~r/.+/, “hello earth”) []