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

URL (Uniform Resource Locator) scheme.

For the purposes of this library, an identifier URL will be matched if it has a scheme and a
host. While `mailto:test@example.com` is a perfectly valid URL, it is not considered a "valid"
identifier URL here.

> #### Parsing {: .info}
>
> Elixir's `URI` module implements [RFC 3986](https://tools.ietf.org/html/rfc3986), not the
> [WHATWG URL standard](https://url.spec.whatwg.org) followed by browsers, which in general
> tends to be more lenient around some edge cases (e.g., unencoded square brackets in query
> strings, backslashes used as path separators). These should generally not be relevant in an
> identifier context, but be aware this module might reject URLs that are accepted by browsers.

# `build_uri`

Builds a URI for the given URL string.

## Examples

    iex> IDUtils.Schemes.URL.build_uri("https://gallica.bnf.fr/f29")
    {:ok, %URI{scheme: "https", host: "gallica.bnf.fr", path: "/f29", port: 443}}

# `match?`

Checks whether a string is a URL.

## Examples

    iex> IDUtils.Schemes.URL.match?("https://gallica.bnf.fr/f29")
    true

    iex> IDUtils.Schemes.URL.match?("mailto:test@example.com")
    false

# `normalize`

Normalizes a URL.

## Examples

    iex> IDUtils.Schemes.URL.normalize("https://example.com/12148")
    {:ok, "https://example.com/12148"}

    iex> IDUtils.Schemes.URL.normalize("https://example.com:443")
    {:ok, "https://example.com/"}

    iex> IDUtils.Schemes.URL.normalize("example.com/x6np1wh8k")
    {:error, :invalid_identifier}

---

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