From 03fbc599bb7aaa15ffbbe5a51cc9a21c6a0ba4c0 Mon Sep 17 00:00:00 2001
From: slateny <46876382+slateny@users.noreply.github.com>
Date: Thu, 28 Apr 2022 00:55:27 -0700
Subject: [PATCH 1/2] Add more specific definition of \w

---
 Doc/library/re.rst | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 8d62e3bf4d8d83..e901b24432f2f8 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -523,10 +523,11 @@ character ``'$'``.
 
 ``\w``
    For Unicode (str) patterns:
-      Matches Unicode word characters; this includes most characters
-      that can be part of a word in any language, as well as numbers and
-      the underscore. If the :const:`ASCII` flag is used, only
-      ``[a-zA-Z0-9_]`` is matched.
+      Matches Unicode word characters; this includes most alphanumeric characters
+      as well as the underscore. In Unicode, alphanumeric characters are defined
+      to be the general categories L + N
+      (see `Unicode General Category Values <https://unicode.org/reports/tr44/#General_Category_Values>`_).
+      If the :const:`ASCII` flag is used, only ``[a-zA-Z0-9_]`` is matched.
 
    For 8-bit (bytes) patterns:
       Matches characters considered alphanumeric in the ASCII character set;

From 2cca82a2243d8f212e049f4c4242048f31882783 Mon Sep 17 00:00:00 2001
From: slateny <46876382+slateny@users.noreply.github.com>
Date: Tue, 3 May 2022 17:34:39 -0700
Subject: [PATCH 2/2] Update Doc/library/re.rst

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
---
 Doc/library/re.rst | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index e901b24432f2f8..f33b36855e2e76 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -523,10 +523,8 @@ character ``'$'``.
 
 ``\w``
    For Unicode (str) patterns:
-      Matches Unicode word characters; this includes most alphanumeric characters
-      as well as the underscore. In Unicode, alphanumeric characters are defined
-      to be the general categories L + N
-      (see `Unicode General Category Values <https://unicode.org/reports/tr44/#General_Category_Values>`_).
+      Matches Unicode word characters; this includes alphanumeric characters (as defined by :meth:`str.isalnum`)
+      as well as the underscore (``_``).
       If the :const:`ASCII` flag is used, only ``[a-zA-Z0-9_]`` is matched.
 
    For 8-bit (bytes) patterns: