diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-21 10:08:52 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-21 10:08:52 (GMT) |
commit | a3369a524c6f862936c1d8a24e23c796aa91f2c7 (patch) | |
tree | f176fc626404d514a14cef2d95e5c784d1494b55 /Doc/library | |
parent | a1543cdcd65d9a2be302be0da0cfb9c53c17f806 (diff) | |
download | cpython-a3369a524c6f862936c1d8a24e23c796aa91f2c7.zip cpython-a3369a524c6f862936c1d8a24e23c796aa91f2c7.tar.gz cpython-a3369a524c6f862936c1d8a24e23c796aa91f2c7.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/library')
-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 dfc25ea..c3c8b65 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -281,7 +281,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: @@ -301,7 +303,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)`` |