]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Docs: Add missing lines between regex and text (GH-134505) (GH-135719)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 19 Jun 2025 15:07:40 +0000 (17:07 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Jun 2025 15:07:40 +0000 (15:07 +0000)
Docs: Add missing lines between regex and text (GH-134505)
(cherry picked from commit 754190287ece5a2e66684161aadafb18f5f44868)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Doc/howto/regex.rst

index 5e2f9a9d1837fe03c5f6cb973ae23f3352e26575..031caea3cec3600d53774ced347824747b807d7a 100644 (file)
@@ -1013,7 +1013,9 @@ extension.  This regular expression matches ``foo.bar`` and
 Now, consider complicating the problem a bit; what if you want to match
 filenames where the extension is not ``bat``? Some incorrect attempts:
 
-``.*[.][^b].*$``  The first attempt above tries to exclude ``bat`` by requiring
+``.*[.][^b].*$``
+
+The first attempt above tries to exclude ``bat`` by requiring
 that the first character of the extension is not a ``b``.  This is wrong,
 because the pattern also doesn't match ``foo.bar``.
 
@@ -1040,7 +1042,9 @@ confusing.
 
 A negative lookahead cuts through all this confusion:
 
-``.*[.](?!bat$)[^.]*$``  The negative lookahead means: if the expression ``bat``
+``.*[.](?!bat$)[^.]*$``
+
+The negative lookahead means: if the expression ``bat``
 doesn't match at this point, try the rest of the pattern; if ``bat$`` does
 match, the whole pattern will fail.  The trailing ``$`` is required to ensure
 that something like ``sample.batch``, where the extension only starts with