Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e670c2

Browse files
author
Mark Summerfield
committed
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
1 parent 1d138f1 commit 9e670c2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Doc/library/re.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ The special characters are:
181181
``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match any
182182
character except ``'^'``.
183183

184+
Note that inside ``[]`` the special forms and special characters lose
185+
their meanings and only the syntaxes described here are valid. For
186+
example, ``+``, ``*``, ``(``, ``)``, and so on are treated as
187+
literals inside ``[]``, and backreferences cannot be used inside
188+
``[]``.
189+
184190
``'|'``
185191
``A|B``, where A and B can be arbitrary REs, creates a regular expression that
186192
will match either A or B. An arbitrary number of REs can be separated by the

0 commit comments

Comments
 (0)