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 aValidationError
withmessage
andcode
if a match is not found. That standard behavior can be reversed by settinginverse_match
toTrue
, in which case theValidationError
is raised when a match is found. By default, matches any string (including an empty string).
-
message
-
The error message used by
ValidationError
if validation fails. Defaults to"Enter a valid value"
.
-
code
-
The error code used by
ValidationError
if 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
. Ifregex
is a pre-compiled regular expression, andflags
is overridden,TypeError
is raised. Defaults to0
.
Please login to continue.