From b406c3ea2889b386efc5d97999ff1de3c2ddf128 Mon Sep 17 00:00:00 2001 From: seanfagan Date: Tue, 21 Mar 2017 11:27:42 -0500 Subject: [PATCH] [1.11.x] Fixed #27945 -- Clarified that RegexValidator searches with the regex. Backport of 325db2a8c3453a56db5e0df0eed37476eb67802d from master --- django/core/validators.py | 4 ++-- docs/ref/validators.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/django/core/validators.py b/django/core/validators.py index 11a3d8e69f0..ea18685fdb4 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -54,8 +54,8 @@ class RegexValidator(object): def __call__(self, value): """ - Validates that the input matches the regular expression - if inverse_match is False, otherwise raises ValidationError. + Validate that the input contains a match for the regular expression + if inverse_match is False, otherwise raise ValidationError. """ if not (self.inverse_match is not bool(self.regex.search( force_text(value)))): diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt index 417df517a4a..eeac982bdc6 100644 --- a/docs/ref/validators.txt +++ b/docs/ref/validators.txt @@ -85,8 +85,8 @@ to, or in lieu of custom ``field.clean()`` methods. .. attribute:: regex - The regular expression pattern to search for the provided ``value``, - or a pre-compiled regular expression. By default, raises a + The regular expression pattern to search for within the provided + ``value``, or a pre-compiled regular expression. By default, raises a :exc:`~django.core.exceptions.ValidationError` with :attr:`message` and :attr:`code` if a match is not found. That standard behavior can be reversed by setting :attr:`inverse_match` to ``True``, in which case