[Django] #27945: RegexValidator uses search instead of match

44 views
Skip to first unread message

Django

unread,
Mar 16, 2017, 7:11:51 AM3/16/17
to django-...@googlegroups.com
#27945: RegexValidator uses search instead of match
-----------------------------------------+------------------------
Reporter: Shubham Jain | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
The documentation says, RegexValidator matches the regex against the
value, and hence ideally it must use regex.match but instead uses
regex.search.

This looks like a bug.

--
Ticket URL: <https://code.djangoproject.com/ticket/27945>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 16, 2017, 7:12:38 AM3/16/17
to django-...@googlegroups.com
#27945: RegexValidator uses search instead of match
------------------------------+--------------------------------------

Reporter: Shubham Jain | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Shubham Jain):

* type: Uncategorized => Bug
* has_patch: 0 => 1
* component: Uncategorized => Core (Other)
* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:1>

Django

unread,
Mar 16, 2017, 8:14:38 AM3/16/17
to django-...@googlegroups.com
#27945: RegexValidator uses search instead of match
------------------------------+--------------------------------------

Reporter: Shubham Jain | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
------------------------------+--------------------------------------

Comment (by Tim Graham):

Where's the documentation you quoted?
[https://docs.djangoproject.com/en/dev/ref/validators/#django.core.validators.RegexValidator.regex
I see], "The regular expression pattern to search for the provided value".
Presumably the documentation you mentioned should be fixed since changing
behavior would be backwards incompatible.

--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:2>

Django

unread,
Mar 16, 2017, 8:32:49 AM3/16/17
to django-...@googlegroups.com
#27945: RegexValidator uses search instead of match
------------------------------+--------------------------------------

Reporter: Shubham Jain | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
------------------------------+--------------------------------------

Comment (by Shubham Jain):

So the
[documentation](https://docs.djangoproject.com/en/dev/ref/validators/#django.core.validators.RegexValidator.regex)
says, "regex pattern to search for provided value". I suppose this means,
you try to see if value fits in the regex. But instead it sees if regex
fits anywhere in the value. So in documentation, it must be "regex pattern
to search for, in the provided value".

--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:3>

Django

unread,
Mar 16, 2017, 8:54:22 PM3/16/17
to django-...@googlegroups.com
#27945: Clarify RegexValidator docs (match vs. search)
--------------------------------------+------------------------------------

Reporter: Shubham Jain | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* type: Bug => Cleanup/optimization
* has_patch: 1 => 0
* stage: Unreviewed => Accepted
* component: Core (Other) => Documentation


--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:4>

Django

unread,
Mar 17, 2017, 11:51:25 AM3/17/17
to django-...@googlegroups.com
#27945: Clarify RegexValidator docs (match vs. search)
-------------------------------------+-------------------------------------
Reporter: Shubham Jain | Owner: Sean
Type: | Fagan
Cleanup/optimization | Status: assigned

Component: Documentation | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sean Fagan):

* status: new => assigned
* owner: nobody => Sean Fagan


--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:5>

Django

unread,
Mar 17, 2017, 1:13:47 PM3/17/17
to django-...@googlegroups.com
#27945: Clarify RegexValidator docs (match vs. search)
-------------------------------------+-------------------------------------
Reporter: Shubham Jain | Owner: Sean
Type: | Fagan
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sean Fagan):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8203 Pull Request] added

--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:6>

Django

unread,
Mar 21, 2017, 12:27:51 PM3/21/17
to django-...@googlegroups.com
#27945: Clarify RegexValidator docs (match vs. search)
-------------------------------------+-------------------------------------
Reporter: Shubham Jain | Owner: Sean
Type: | Fagan
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"325db2a8c3453a56db5e0df0eed37476eb67802d" 325db2a8]:
{{{
#!CommitTicketReference repository=""
revision="325db2a8c3453a56db5e0df0eed37476eb67802d"
Fixed #27945 -- Clarified that RegexValidator searches with the regex.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:7>

Django

unread,
Mar 21, 2017, 12:51:06 PM3/21/17
to django-...@googlegroups.com
#27945: Clarify RegexValidator docs (match vs. search)
-------------------------------------+-------------------------------------
Reporter: Shubham Jain | Owner: Sean
Type: | Fagan
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"b406c3ea2889b386efc5d97999ff1de3c2ddf128" b406c3ea]:
{{{
#!CommitTicketReference repository=""
revision="b406c3ea2889b386efc5d97999ff1de3c2ddf128"
[1.11.x] Fixed #27945 -- Clarified that RegexValidator searches with the
regex.

Backport of 325db2a8c3453a56db5e0df0eed37476eb67802d from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27945#comment:8>

Reply all
Reply to author
Forward
0 new messages