diff options
Diffstat (limited to 'Doc/library/re.rst')
-rw-r--r-- | Doc/library/re.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index ce52185d13..f46661429e 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -221,7 +221,7 @@ The special characters are: ``'s'``, ``'u'``, ``'x'``.) The group matches the empty string; the letters set the corresponding flags: :const:`re.a` (ASCII-only matching), :const:`re.I` (ignore case), :const:`re.L` (locale dependent), - :const:`re.M` (multi-line), :const:`re.S` (dot matches all), + :const:`re.M` (multi-line), :const:`re.S` (dot matches all), and :const:`re.X` (verbose), for the entire regular expression. (The flags are described in :ref:`contents-of-module-re`.) This is useful if you wish to include the flags as part of the regular @@ -487,7 +487,7 @@ form. counterpart ``(?u)``), but these are redundant in Python 3.0 since matches are Unicode by default for strings (and Unicode matching isn't allowed for bytes). - + .. data:: I IGNORECASE @@ -1011,14 +1011,14 @@ method of :class:`MatchObject` in the following manner: >>> pair.match("717ak").group(1) '7' - + # Error because re.match() returns None, which doesn't have a group() method: >>> pair.match("718ak").group(1) Traceback (most recent call last): File "<pyshell#23>", line 1, in <module> re.match(r".*(.).*\1", "718ak").group(1) AttributeError: 'NoneType' object has no attribute 'group' - + >>> pair.match("354aa").group(1) 'a' @@ -1127,7 +1127,7 @@ where the search is to start: Making a Phonebook ^^^^^^^^^^^^^^^^^^ -:func:`split` splits a string into a list delimited by the passed pattern. The +:func:`split` splits a string into a list delimited by the passed pattern. The method is invaluable for converting textual data into data structures that can be easily read and modified by Python as demonstrated in the following example that creates a phonebook. @@ -1136,7 +1136,7 @@ First, here is the input. Normally it may come from a file, here we are using triple-quoted string syntax: >>> input = """Ross McFluff: 834.345.1254 155 Elm Street - ... + ... ... Ronald Heathmore: 892.345.3428 436 Finley Avenue ... Frank Burger: 925.541.7625 662 South Dogwood Way ... |