mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00:00
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
This commit is contained in:
parent
1d138f1c1a
commit
9e670c2161
1 changed files with 6 additions and 0 deletions
|
|
@ -181,6 +181,12 @@ The special characters are:
|
||||||
``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match any
|
``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match any
|
||||||
character except ``'^'``.
|
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
|
``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
|
will match either A or B. An arbitrary number of REs can be separated by the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue