JSON Schema pattern Keyword

The pattern keyword applies a regex to string values.

Syntax

{"type": "string", "pattern": "^[a-z0-9-]+$"}

Explanation

Use pattern for slugs, identifiers and restricted text formats.