[New-bugs-announce] [issue40043] Poor RegEx example for (?(id/name)yes-pattern|no-pattern)

Leon Hampton report at bugs.python.org
Sun Mar 22 13:44:39 EDT 2020


New submission from Leon Hampton <Leon_Hampton at yahoo.com>:

Hello,
In the 3.7.7 documentation on Regular Expression, the Conditional Construct, (?(id/name)yes-pattern|no-pattern), is discussed. (This is a very thorough document, by the way. Good job!)
One example given for the Conditional Construct does not work as described. Specifically, the example gives this matching pattern '(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)' and states that it will NOT MATCH the string '<user at host.com'. In my tests the pattern DOES MATCH that string.
(The other examples work as described.) 
This may be a bug in re since it seems to me that the match should fail.
Respectfully,
Leon

----------
assignee: docs at python
components: Documentation
messages: 364811
nosy: LHampton, docs at python
priority: normal
severity: normal
status: open
title: Poor RegEx example for (?(id/name)yes-pattern|no-pattern)
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40043>
_______________________________________


More information about the New-bugs-announce mailing list