From: Mark Summerfield Date: Sat, 31 May 2008 13:05:34 +0000 (+0000) Subject: Added a note to [] that special forms & special chars lose their meaning X-Git-Tag: v3.0b1~185 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e670c216164bd9e437ffefeba31fb0a7865b932;p=thirdparty%2FPython%2Fcpython.git Added a note to [] that special forms & special chars lose their meaning and backrefs can't be used inside [] --- diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 707eedfa6a5f..58313641dee2 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -181,6 +181,12 @@ The special characters are: ``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match any character except ``'^'``. + Note that inside ``[]`` the special forms and special characters lose + their meanings and only the syntaxes described here are valid. For + example, ``+``, ``*``, ``(``, ``)``, and so on are treated as + literals inside ``[]``, and backreferences cannot be used inside + ``[]``. + ``'|'`` ``A|B``, where A and B can be arbitrary REs, creates a regular expression that will match either A or B. An arbitrary number of REs can be separated by the