What does \d
do in this example?
/Chapter (\d+)\.\d*/
Decimal digit character: \d \d matches any decimal digit. It is equivalent to the \p{Nd} regular expression pattern, which includes the standard decimal digits 0-9 as well as the decimal digits of a number of other character sets. If ECMAScript-compliant behavior is specified, \d is equivalent to [0-9].
The \D metacharacter matches non-digit characters.
The RegExp \B Metacharacter in JavaScript is used to find a match which is not present at the beginning or end of a word. If a match is found it returns the word else it returns NULL.
In what context?
In a regular expression, it matches a digit (0-9).
Edit, according to your comment:
It matches any string starting with Chapter, followed by digits, then a dot, then a number of digits. Like Chapter 1.0
and Chapter 12.01
.
In a regex it means digits 0-9
\d
Digits 0 through 9 /H\d/
matches "H3"
If it is in a regular expression (match
or replace
or split
) or a /
.../
string then it probably means match any digit 0-9. Please provide the code you see it in so we can be sure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With