# `Moar.Regex`
[🔗](https://github.com/synchronal/moar/blob/main/lib/regex.ex#L1)

Regex-related functions.

# `named_capture`

```elixir
@spec named_capture(binary() | Regex.t(), binary() | Regex.t(), binary()) :: term()
```

Returns a single named capture. Can take the first two args in any order.

```
iex> Moar.Regex.named_capture(~r/a(?<foo>b)c(?<bar>d)/, "abcd", "foo")
"b"

iex> Moar.Regex.named_capture("abcd", ~r/a(?<foo>b)c(?<bar>d)/, "foo")
"b"
```

# `named_captures`

```elixir
@spec named_captures(binary() | Regex.t(), binary() | Regex.t(), [term()]) ::
  map() | nil
```

Like `Regex.named_captures/3` but can take the first two args in any order.

```
iex> Moar.Regex.named_captures(~r/a(?<foo>b)c(?<bar>d)/, "abcd")
%{"bar" => "d", "foo" => "b"}

iex> Moar.Regex.named_captures("abcd", ~r/a(?<foo>b)c(?<bar>d)/)
%{"bar" => "d", "foo" => "b"}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
