diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-21 10:08:36 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-21 10:08:36 (GMT) |
commit | 4809d1fccd81bd3e1e4b08152545cfd88b69231c (patch) | |
tree | f3e5022ed49fbf2b5c4fd972b62572fcf5b06690 /Doc | |
parent | 021d55ff745268299f8c3d487aac7f12a01ec294 (diff) | |
download | cpython-4809d1fccd81bd3e1e4b08152545cfd88b69231c.zip cpython-4809d1fccd81bd3e1e4b08152545cfd88b69231c.tar.gz cpython-4809d1fccd81bd3e1e4b08152545cfd88b69231c.tar.bz2 |
Issues #814253, #9179: Warnings now are raised when group references and
conditional group references are used in lookbehind assertions in regular
expressions.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/re.rst | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index db7e1cf..b353c4c 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -276,7 +276,9 @@ The special characters are: assertion`. ``(?<=abc)def`` will find a match in ``abcdef``, since the lookbehind will back up 3 characters and check if the contained pattern matches. The contained pattern must only match strings of some fixed length, meaning that - ``abc`` or ``a|b`` are allowed, but ``a*`` and ``a{3,4}`` are not. Note that + ``abc`` or ``a|b`` are allowed, but ``a*`` and ``a{3,4}`` are not. Group + references are not supported even if they match strings of some fixed length. + Note that patterns which start with positive lookbehind assertions will not match at the beginning of the string being searched; you will most likely want to use the :func:`search` function rather than the :func:`match` function: @@ -296,7 +298,8 @@ The special characters are: Matches if the current position in the string is not preceded by a match for ``...``. This is called a :dfn:`negative lookbehind assertion`. Similar to positive lookbehind assertions, the contained pattern must only match strings of - some fixed length. Patterns which start with negative lookbehind assertions may + some fixed length and shouldn't contain group references. + Patterns which start with negative lookbehind assertions may match at the beginning of the string being searched. ``(?(id/name)yes-pattern|no-pattern)`` |