[docs] Bug in documentation

Ovidiu Durbalau crusarovid at gmail.com
Tue Dec 18 16:20:54 EST 2018


In the following page:

https://docs.python.org/3.5/howto/regex.html#matching-characters



The following 2 paragraphs are contradictory:



Metacharacters are not active inside classes. For example, [akm$] will
match any of the characters 'a', 'k', 'm', or '$'; '$' is usually a
metacharacter, but inside a character class it’s stripped of its special
nature.

You can match the characters not listed within the class by *complementing* the
set. This is indicated by including a '^' as the first character of the
class; '^' outside a character class will simply match the '^'character. For
example, [^5] will match any character except '5'.

The first paragraph says metacharacters are not active inside character
classes.

The second paragraph shows an example of a metacharacter in a character
class having some “special nature”. In the example, it is treated as the
inverse or complement.

-- 
Ovidiu Durbalau


Software Developer | Houle <http://www.houle.ca>
Computing Science Major | Simon Fraser University <http://sfu.ca>
604 754 9116 | LinkedIn
<http://ca.linkedin.com/pub/ovidiu-durbalau/5b/709/463> | Twitter
<https://twitter.com/divodurbalau>| Facebook
<https://www.facebook.com/crusarovid>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20181218/09dc4676/attachment.html>


More information about the docs mailing list