@@ -1131,6 +1131,11 @@ msgid ""
11311131">>> print(p.search('\\ b' + 'class' + '\\ b'))\n"
11321132"<re.Match object; span=(0, 7), match='\\ x08class\\ x08'>"
11331133msgstr ""
1134+ ">>> p = re.compile('\\ bclass\\ b')\n"
1135+ ">>> print(p.search('no class at all'))\n"
1136+ "None\n"
1137+ ">>> print(p.search('\\ b' + 'class' + '\\ b'))\n"
1138+ "<re.Match object; span=(0, 7), match='\\ x08class\\ x08'>"
11341139
11351140msgid ""
11361141"Second, inside a character class, where there's no use for this assertion, "
@@ -1163,6 +1168,10 @@ msgid ""
11631168"MIME-Version: 1.0\n"
11641169"To: editor@example.com"
11651170msgstr ""
1171+ "From: author@example.com\n"
1172+ "User-Agent: Thunderbird 1.5.0.9 (X11/20061227)\n"
1173+ "MIME-Version: 1.0\n"
1174+ "To: editor@example.com"
11661175
11671176msgid ""
11681177"This can be handled by writing a regular expression which matches an entire "
@@ -1207,6 +1216,12 @@ msgid ""
12071216">>> m.group(0)\n"
12081217"'ab'"
12091218msgstr ""
1219+ ">>> p = re.compile('(a)b')\n"
1220+ ">>> m = p.match('ab')\n"
1221+ ">>> m.group()\n"
1222+ "'ab'\n"
1223+ ">>> m.group(0)\n"
1224+ "'ab'"
12101225
12111226msgid ""
12121227"Subgroups are numbered from left to right, from 1 upward. Groups can be "
@@ -1224,6 +1239,14 @@ msgid ""
12241239">>> m.group(2)\n"
12251240"'b'"
12261241msgstr ""
1242+ ">>> p = re.compile('(a(b)c)d')\n"
1243+ ">>> m = p.match('abcd')\n"
1244+ ">>> m.group(0)\n"
1245+ "'abcd'\n"
1246+ ">>> m.group(1)\n"
1247+ "'abc'\n"
1248+ ">>> m.group(2)\n"
1249+ "'b'"
12271250
12281251msgid ""
12291252":meth:`~re.Match.group` can be passed multiple group numbers at a time, in "
@@ -1336,6 +1359,12 @@ msgid ""
13361359">>> m.groups()\n"
13371360"()"
13381361msgstr ""
1362+ ">>> m = re.match(\" ([abc])+\" ,\" abc\" )\n"
1363+ ">>> m.groups()\n"
1364+ "('c',)\n"
1365+ ">>> m = re.match(\" (?:[abc])+\" ,\" abc\" )\n"
1366+ ">>> m.groups()\n"
1367+ "()"
13391368
13401369msgid ""
13411370"Except for the fact that you can't retrieve the contents of what the group "
@@ -1402,6 +1431,12 @@ msgid ""
14021431" r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'\n"
14031432" r'\" ')"
14041433msgstr ""
1434+ "InternalDate = re.compile(r'INTERNALDATE\" '\n"
1435+ " r'(?P<day>[ 123][0-9])-(?P<mon>[A-Z][a-z][a-z])-'\n"
1436+ " r'(?P<year>[0-9][0-9][0-9][0-9])'\n"
1437+ " r' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])'\n"
1438+ " r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'\n"
1439+ " r'\" ')"
14051440
14061441msgid ""
14071442"It's obviously much easier to retrieve ``m.group('zonem')``, instead of "
@@ -1484,7 +1519,7 @@ msgid ""
14841519msgstr ""
14851520
14861521msgid "``.*[.][^b].*$``"
1487- msgstr ""
1522+ msgstr "``.*[.][^b].*$`` "
14881523
14891524msgid ""
14901525"The first attempt above tries to exclude ``bat`` by requiring that the first "
@@ -1525,7 +1560,7 @@ msgid "A negative lookahead cuts through all this confusion:"
15251560msgstr ""
15261561
15271562msgid "``.*[.](?!bat$)[^.]*$``"
1528- msgstr ""
1563+ msgstr "``.*[.](?!bat$)[^.]*$`` "
15291564
15301565msgid ""
15311566"The negative lookahead means: if the expression ``bat`` doesn't match at "
@@ -1724,6 +1759,9 @@ msgid ""
17241759">>> p.sub(r'subsection{\\ 1}','section{First} section{second}')\n"
17251760"'subsection{First} subsection{second}'"
17261761msgstr ""
1762+ ">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n"
1763+ ">>> p.sub(r'subsection{\\ 1}','section{First} section{second}')\n"
1764+ "'subsection{First} subsection{second}'"
17271765
17281766msgid ""
17291767"There's also a syntax for referring to named groups as defined by the ``(?"
@@ -1904,6 +1942,13 @@ msgid ""
19041942">>> print(re.match('<.*>', s).group())\n"
19051943"<html><head><title>Title</title>"
19061944msgstr ""
1945+ ">>> s = '<html><head><title>Title</title>'\n"
1946+ ">>> len(s)\n"
1947+ "32\n"
1948+ ">>> print(re.match('<.*>', s).span())\n"
1949+ "(0, 32)\n"
1950+ ">>> print(re.match('<.*>', s).group())\n"
1951+ "<html><head><title>Title</title>"
19071952
19081953msgid ""
19091954"The RE matches the ``'<'`` in ``'<html>'``, and the ``.*`` consumes the rest "
@@ -1979,7 +2024,7 @@ msgid "This is far more readable than::"
19792024msgstr "Jest to o wiele bardziej czytelne niż::"
19802025
19812026msgid "pat = re.compile(r\"\\ s*(?P<header>[^:]+)\\ s*:(?P<value>.*?)\\ s*$\" )"
1982- msgstr ""
2027+ msgstr "pat = re.compile(r \"\\ s*(?P<header>[^:]+) \\ s*:(?P<value>.*?) \\ s*$ \" ) "
19832028
19842029msgid "Feedback"
19852030msgstr "Feedback"