Skip to content

bagof.validators.strings

Validators for string types (regex patterns, etc.).

Classes

MatchesRegex

MatchesRegex(pattern: str | Pattern, hint: Any = UNSET, compose: bool = False)

Bases: Validator[STR]

Validator for strings that match a regex pattern.

Parameters:

Name Type Description Default
pattern str | Pattern

The regex pattern to match against.

required
hint Any

The type hint to validate against.

UNSET
compose bool

Whether to compose this validator with others, when they are found in Annotated metadata.

False

Methods: