Issue 28136: RegEx documentation error (original) (raw)

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:36

admin

set

github: 72323

2016-09-13 23:57:43

triuan

set

messages: +

2016-09-13 20:43:06

SilentGhost

set

status: open -> closed
resolution: not a bug
type: behavior
stage: resolved

2016-09-13 20:40:41

christian.heimes

set

nosy: + christian.heimes
messages: +

2016-09-13 20:34:16

triuan

set

messages: +

2016-09-13 20:30:12

triuan

create