This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: RegEx documentation error
Type: behavior Stage: resolved
Components: Documentation Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: christian.heimes, docs@python, triuan
Priority: normal Keywords:

Created on 2016-09-13 20:30 by triuan, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg276336 - (view) Author: triuan (triuan) Date: 2016-09-13 20:30
https://docs.python.org/2/library/re.html

error:
...string 'aaaaaa', a{3,5} will match 5 'a' characters...

suggest correction:
...string 'aaaaaa', a{5} will match 5 'a' characters...
msg276338 - (view) Author: triuan (triuan) Date: 2016-09-13 20:34
https://docs.python.org/2/library/re.html

error:
...string 'aaaaaa', a{3,5} will match 5 'a' characters...

suggest correction 2:
...string 'aaaaaa', a{3, 5} will match 3 to 5 'a' characters...
msg276340 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-13 20:40
The documentation is correct. It explains the difference between a default match (greedy) and a non-greedy match.

>>> re.match('(a{3,5})', 'aaaaa').group(1)
'aaaaa'
>>> re.match('(a{3,5}?)', 'aaaaa').group(1)
'aaa'
msg276362 - (view) Author: triuan (triuan) Date: 2016-09-13 23:57
thanks!
History
Date User Action Args
2022-04-11 14:58:36adminsetgithub: 72323
2016-09-13 23:57:43triuansetmessages: + msg276362
2016-09-13 20:43:06SilentGhostsetstatus: open -> closed
resolution: not a bug
type: behavior
stage: resolved
2016-09-13 20:40:41christian.heimessetnosy: + christian.heimes
messages: + msg276340
2016-09-13 20:34:16triuansetmessages: + msg276338
2016-09-13 20:30:12triuancreate