Skip to content

Commit 325db2a

Browse files
seanfagantimgraham
authored andcommitted
Fixed #27945 -- Clarified that RegexValidator searches with the regex.
1 parent 43380e9 commit 325db2a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

django/core/validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self, regex=None, message=None, code=None, inverse_match=None, flag
5252

5353
def __call__(self, value):
5454
"""
55-
Validate that the input matches the regular expression
55+
Validate that the input contains a match for the regular expression
5656
if inverse_match is False, otherwise raise ValidationError.
5757
"""
5858
if not (self.inverse_match is not bool(self.regex.search(

docs/ref/validators.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ to, or in lieu of custom ``field.clean()`` methods.
8585

8686
.. attribute:: regex
8787

88-
The regular expression pattern to search for the provided ``value``,
89-
or a pre-compiled regular expression. By default, raises a
88+
The regular expression pattern to search for within the provided
89+
``value``, or a pre-compiled regular expression. By default, raises a
9090
:exc:`~django.core.exceptions.ValidationError` with :attr:`message`
9191
and :attr:`code` if a match is not found. That standard behavior can
9292
be reversed by setting :attr:`inverse_match` to ``True``, in which case

0 commit comments

Comments
 (0)