summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-09-11 09:50:02 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-09-11 09:50:02 (GMT)
commitbd48d27944453ad83d3ce37b2c867fa0d59a1c15 (patch)
treef5585b5ce3995541ed6cce7bb4daef97f936be89 /Doc
parent352601ca00376aaf07d4399096f985d3d8ecb96f (diff)
downloadcpython-bd48d27944453ad83d3ce37b2c867fa0d59a1c15.zip
cpython-bd48d27944453ad83d3ce37b2c867fa0d59a1c15.tar.gz
cpython-bd48d27944453ad83d3ce37b2c867fa0d59a1c15.tar.bz2
Issue #22493: Inline flags now should be used only at the start of the
regular expression. Deprecation warning is emitted if uses them in the middle of the regular expression.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/re.rst8
-rw-r--r--Doc/whatsnew/3.6.rst9
2 files changed, 11 insertions, 6 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 5297f0b..87cd553 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -224,12 +224,8 @@ The special characters are:
flags are described in :ref:`contents-of-module-re`.) This
is useful if you wish to include the flags as part of the regular
expression, instead of passing a *flag* argument to the
- :func:`re.compile` function.
-
- Note that the ``(?x)`` flag changes how the expression is parsed. It should be
- used first in the expression string, or after one or more whitespace characters.
- If there are non-whitespace characters before the flag, the results are
- undefined.
+ :func:`re.compile` function. Flags should be used first in the
+ expression string.
``(?:...)``
A non-capturing version of regular parentheses. Matches whatever regular
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 6bb3469..8752b83 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -1124,6 +1124,15 @@ Deprecated features
that will not be for several Python releases. (Contributed by Emanuel Barry
in :issue:`27364`.)
+* Inline flags ``(?letters)`` now should be used only at the start of the
+ regular expression. Inline flags in the middle of the regular expression
+ affects global flags in Python :mod:`re` module. This is an exception to
+ other regular expression engines that either apply flags to only part of
+ the regular expression or treat them as an error. To avoid distinguishing
+ inline flags in the middle of the regular expression now emit a deprecation
+ warning. It will be an error in future Python releases.
+ (Contributed by Serhiy Storchaka in :issue:`22493`.)
+
Deprecated Python behavior
--------------------------