class RegexValidator(regex=None, message=None, code=None, inverse_match=None, flags=0) [source]
| Parameters: |
|
|---|
-
regex -
The regular expression pattern to search for the provided
value, or a pre-compiled regular expression. By default, raises aValidationErrorwithmessageandcodeif a match is not found. That standard behavior can be reversed by settinginverse_matchtoTrue, in which case theValidationErroris raised when a match is found. By default, matches any string (including an empty string).
-
message -
The error message used by
ValidationErrorif validation fails. Defaults to"Enter a valid value".
-
code -
The error code used by
ValidationErrorif validation fails. Defaults to"invalid".
-
inverse_match -
The match mode for
regex. Defaults toFalse.
-
flags -
The flags used when compiling the regular expression string
regex. Ifregexis a pre-compiled regular expression, andflagsis overridden,TypeErroris raised. Defaults to0.
Please login to continue.