# `IDUtils.Schemes.URN`
[🔗](https://github.com/moefuerst/id_utils/blob/v0.1.0/lib/id_utils/schemes/urn.ex#L1)

URN (Uniform Resource Name) scheme.

For the purposes of this library, an URN is considered "valid" if its namespace identifier is
registered with the IANA as "formal". Registered "informal" namespace identifiers will not
match.

See https://www.rfc-editor.org/info/rfc8141/

# `match?`

Checks whether a string is a URN.

## Examples

    iex> IDUtils.Schemes.URN.match?("urn:ietf:rfc:2648")
    true

    iex> IDUtils.Schemes.URN.match?("urn:nbn:at:AT-UBG:3-13")
    true

    iex> IDUtils.Schemes.URN.match?("urn:unregistered:foo:bar")
    false

    iex> IDUtils.Schemes.URN.match?("https://nbn-resolving.org/urn:nbn:at:AT-UBG:3-13")
    false

# `namespaces`

```elixir
@spec namespaces() :: MapSet.t()
```

Returns all URN NIDs registered as "formal" with IANA.

The dataset is sourced from the
[IANA Registry of URN Namespaces](https://www.iana.org/assignments/urn-namespaces) and covers
all formal namespace identifiers registered as of the release date of this version of IDUtils.

# `normalize`

Normalizes a URN.

## Examples

    iex> IDUtils.Schemes.URN.normalize("URN:NBN:fi-fe19981001")
    {:ok, "urn:nbn:fi-fe19981001"}

    iex> IDUtils.Schemes.URN.normalize("example.com/URN:NBN:fi-fe19981001")
    {:error, :invalid_identifier}

---

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