What does \d+ mean in a regular expression?

\d is a digit (a character in the range [0-9]), and + means one or more times. Thus, \d+ means match one or more digits.

For example, the string "42" is matched by the pattern \d+.


You can also find explanations for pieces of regular expressions like this using a tool like Regex101 (online, free) or Regex Coach (downloadable for Windows, free) that will let you enter a regular expression and sample text, then indicate what (if anything) matches the regex. They also try to explain, in words, what the regular expression does.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)