[Django] #28135: simplify_regex() doesn't handle non-capturing groups

8 views
Skip to first unread message

Django

unread,
Apr 26, 2017, 12:27:43 PM4/26/17
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------------+------------------------
Reporter: German M. Bravo | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
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 |
-------------------------------------------+------------------------
While using Django REST Framework's Schema generator, I found out they're
using `simplify_regex()`; however, current version has a few shortcomings,
namely non-capturing groups are broken.

I added a pull request (see https://github.com/django/django/pull/8414)
which fixes this problems, it also is faster and handles many more regex
patterns. I also extended the `test_simplify_regex` test.

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

Django

unread,
Apr 26, 2017, 12:53:24 PM4/26/17
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
--------------------------------------+------------------------------------

Reporter: German M. Bravo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* type: Uncategorized => Cleanup/optimization
* has_patch: 0 => 1
* component: Uncategorized => contrib.admindocs
* stage: Unreviewed => Accepted


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

Django

unread,
May 26, 2017, 9:29:20 AM5/26/17
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
--------------------------------------+------------------------------------

Reporter: German M. Bravo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


Comment:

I left comments for improvement on the PR. Please uncheck "Patch needs
improvement" after updating.

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

Django

unread,
Feb 12, 2021, 2:02:33 AM2/12/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
--------------------------------------+------------------------------------

Reporter: German M. Bravo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by David Smith):

* easy: 0 => 1


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

Django

unread,
Mar 2, 2021, 4:35:16 AM3/2/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
--------------------------------------+------------------------------------

Reporter: German M. Bravo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Rohith P R):

https://github.com/django/django/pull/14070 : Refs #28135 -- Added
replace_metacharacters to simplify regexes

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

Django

unread,
Mar 2, 2021, 4:36:17 AM3/2/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
--------------------------------------+------------------------------------

Reporter: German M. Bravo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Rohith P R):

* has_patch: 1 => 0


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

Django

unread,
Mar 2, 2021, 4:36:32 AM3/2/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
--------------------------------------+------------------------------------

Reporter: German M. Bravo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


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

Django

unread,
Mar 3, 2021, 12:27:41 AM3/3/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
--------------------------------------+------------------------------------

Reporter: German M. Bravo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admindocs | Version: 1.11
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 Rohith P R):

* needs_better_patch: 1 => 0


* has_patch: 1 => 0


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

Django

unread,
Aug 8, 2021, 8:55:56 PM8/8/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Felix
Type: | Zhang
Cleanup/optimization | Status: assigned

Component: contrib.admindocs | Version: 1.11
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 Felix Zhang):

* owner: nobody => Felix Zhang
* status: new => assigned


Old description:

> While using Django REST Framework's Schema generator, I found out they're
> using `simplify_regex()`; however, current version has a few
> shortcomings, namely non-capturing groups are broken.
>
> I added a pull request (see https://github.com/django/django/pull/8414)
> which fixes this problems, it also is faster and handles many more regex
> patterns. I also extended the `test_simplify_regex` test.

New description:

While using Django REST Framework's Schema generator, I found out they're
using `simplify_regex()`; however, current version has a few shortcomings,
namely non-capturing groups are broken.

--

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

Django

unread,
Aug 9, 2021, 12:50:31 AM8/9/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Felix
Type: | Zhang
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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 Felix Zhang):

* has_patch: 0 => 1


Old description:

> While using Django REST Framework's Schema generator, I found out they're
> using `simplify_regex()`; however, current version has a few
> shortcomings, namely non-capturing groups are broken.

New description:

While using Django REST Framework's Schema generator, I found out they're
using `simplify_regex()`; however, current version has a few shortcomings,
namely non-capturing groups are broken.

I have opened a [https://github.com/django/django/pull/14756 pull request]
that allows `simplify_regex()` to handle non-capturing groups and
additional tests for them in `test_simplify_regex()`.

--

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

Django

unread,
Sep 23, 2021, 2:55:58 AM9/23/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Felix
Type: | Zhang
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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
-------------------------------------+-------------------------------------
Description changed by Mariusz Felisiak:

Old description:

> While using Django REST Framework's Schema generator, I found out they're
> using `simplify_regex()`; however, current version has a few
> shortcomings, namely non-capturing groups are broken.
>

> I have opened a [https://github.com/django/django/pull/14756 pull
> request] that allows `simplify_regex()` to handle non-capturing groups
> and additional tests for them in `test_simplify_regex()`.

New description:

While using Django REST Framework's Schema generator, I found out they're
using `simplify_regex()`; however, current version has a few shortcomings,
namely non-capturing groups are broken.

--

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

Django

unread,
Sep 23, 2021, 5:38:13 AM9/23/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Felix
Type: | Zhang
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:9>

Django

unread,
Dec 29, 2021, 3:49:27 AM12/29/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi

Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ayush Joshi):

* owner: Felix Zhang => Ayush Joshi


--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:10>

Django

unread,
Dec 29, 2021, 3:50:50 AM12/29/21
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ayush Joshi):

I've created a patch for this issue I'm about to make a PR :).

--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:11>

Django

unread,
Jan 10, 2022, 9:34:45 PM1/10/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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 Tim Graham):

* needs_better_patch: 1 => 0


Comment:

You need to uncheck "Patch needs improvement" so the ticket appears in the
review queue. Please don't use mass @ mentions on the PR to request a
review.

--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:12>

Django

unread,
Jan 10, 2022, 10:39:08 PM1/10/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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
-------------------------------------+-------------------------------------

Comment (by Ayush Joshi):

Replying to [comment:12 Tim Graham]:


> You need to uncheck "Patch needs improvement" so the ticket appears in
the review queue. Please don't use mass @ mentions on the PR to request a
review.

Sorry, Felisiak never came so I have to ask someone else lol

--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:13>

Django

unread,
Jan 13, 2022, 2:34:13 AM1/13/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:14>

Django

unread,
Jan 13, 2022, 3:41:06 AM1/13/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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 Ayush Joshi):

* needs_better_patch: 1 => 0


Comment:

Replying to [comment:14 Mariusz Felisiak]:

Okay I updated that PR to only include feature, I'll create new PR for
code refactor :thumbsup:.

--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:15>

Django

unread,
Jan 13, 2022, 1:11:16 PM1/13/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"827bc0704761f2c985539d98165420d4fcc0d682" 827bc070]:
{{{
#!CommitTicketReference repository=""
revision="827bc0704761f2c985539d98165420d4fcc0d682"
Refs #28135 -- Refactored out _find_groups()/_get_group_start_end() hooks
in admindocs.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:16>

Django

unread,
Jan 13, 2022, 1:11:49 PM1/13/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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 Mariusz Felisiak):

* has_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:17>

Django

unread,
Jan 13, 2022, 11:37:46 PM1/13/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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
-------------------------------------+-------------------------------------

Comment (by Ayush Joshi):

https://github.com/django/django/pull/15316

--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:18>

Django

unread,
Jan 13, 2022, 11:38:05 PM1/13/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
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 Ayush Joshi):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:19>

Django

unread,
Jan 14, 2022, 5:02:26 AM1/14/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: assigned
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:20>

Django

unread,
Jan 14, 2022, 3:06:16 PM1/14/22
to django-...@googlegroups.com
#28135: simplify_regex() doesn't handle non-capturing groups
-------------------------------------+-------------------------------------
Reporter: German M. Bravo | Owner: Ayush
Type: | Joshi
Cleanup/optimization | Status: closed
Component: contrib.admindocs | Version: 1.11
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"0a17666045de6739ae1c2ac695041823d5f827f7" 0a17666]:
{{{
#!CommitTicketReference repository=""
revision="0a17666045de6739ae1c2ac695041823d5f827f7"
Fixed #28135 -- Made simplify_regex() handle non-capturing groups.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28135#comment:21>

Reply all
Reply to author
Forward
0 new messages