[docs] [issue11283] incorrect pattern in the re module docs for conditional regex

Senthil Kumaran report at bugs.python.org
Mon Feb 28 10:31:06 CET 2011


Senthil Kumaran <orsenthil at gmail.com> added the comment:

Thinking about the regex pattern again. The example given is not really wrong. It does what it claims to match, that is '<user at example.com>' and 'user at example.com' and reject <user at example.com' kind of string. Nothing is said about 'user at example.com>' kind of string. 

Also, this is not an example of validating an email address or finding an email address pattern in text data. A good regex for that purposes would be more complex[1][2].

Having said that, if example of conditional regex has been given - the current one is sufficient (in which case no change is required) or a simpler one can be presented, which may not like matching a email address and thus devoid of any expectations of valid patterns.

Also, if we 'really' think that rejecting 'user at example>' is good idea in the example documentation, then having '$' in no-pattern of regex is good enough. No need to think for regex search cases for the explanation given about.


1: http://www.regular-expressions.info/email.html
2: http://ex-parrot.com/~pdw/Mail-RFC822-Address.html

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11283>
_______________________________________


More information about the docs mailing list