\d Matches any Unicode decimal digit (that is, any character in Unicode character category [Nd]). This includes [0-9], and also many other digit characters.
\w Matches Unicode word characters; this includes all Unicode alphanumeric characters (as defined by str.isalnum()), as well as the underscore (_).
\d Digit character class escape: Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the suite number".
\w Word character class escape: Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_]. For example, /\w/ matches "a" in "apple", "5" in "$5.28", "3" in "3D" and "m" in "Émanuel".
This corresponds to the re.ASCII versions of the Python regexes:
Per https://docs.python.org/3/library/re.html:
However according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes (which given the reference implementation is in JS is likely the implicit reference semantics)
This corresponds to the
re.ASCII
versions of the Python regexes:This might do nothing (because regex uses library means to check those classes) or it might reduce the amount of state the regex needs to store.