# `Ithibati.Schema.Identifier`
[🔗](https://github.com/oliverandrich/ithibati/blob/v0.6.2/lib/ithibati/schema/identifier.ex#L1)

Provides identifier normalization and built-in validation patterns.

`normalize/1`, `username_format/0` and `email_format/0` are available to applications.
The account and invitation macros use the same normalization and validation steps so their
identifiers can be compared consistently.

Other functions in this module support schema expansion and are internal to Ithibati.

# `email_format`

Returns the regex offered for email identifiers.

The pattern accepts forms such as `you@example.com` and `you@localhost` and rejects quoted
local parts such as `"a b"@example.com`. It checks syntax only; it does not verify ownership
of a mailbox. Optional invitation delivery is separate from identifier validation.

This deliberately narrow input format keeps identifiers easy to enter in browser forms.
It does not implement the full RFC 5322 mailbox grammar; a rejected address is not
necessarily an invalid mailbox.

Pass it as `format:` to an account or invitation schema, or supply a pattern of your own.

# `normalize`

Trims and lowercases a string identifier; returns `nil` for `nil`.

# `username_format`

Returns a regex accepting 1–30 lowercase ASCII letters, digits or underscores.

The schema changesets normalize identifiers before applying this pattern. Direct callers
should do the same if they want to accept mixed-case input. Dots, hyphens, spaces and
non-ASCII characters are rejected. This limits punctuation variants and cross-script
lookalikes, such as a Cyrillic letter resembling a Latin one. ASCII still contains
lookalikes; the format does not guarantee that names cannot be confused.

This format is optional. Supply your own `format:` when the application's identifier rules
differ, and use a separate field for a display name.

---

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