Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does \d+ mean in regular expression terms?

Tags:

regex

php

I'm new to regular expressions and came accros the following \d+ . I do not exactly know what this means, please point me in the right direction.

like image 258
Elitmiar Avatar asked May 15 '10 19:05

Elitmiar


People also ask

What does \d mean in JavaScript?

The RegExp \D Metacharacter in JavaScript is used to search non digit characters i.e all the characters except digits. It is same as [^0-9]. Syntax: /\D/

What is W+ in Python regex?

match() function in Python. The match function is used to match the RE pattern to string with the optional flags. In this method, the expression “w+” and “\W” will match the words starting with a letter 'g' and after that, anything which is not started with 'g' is not identified.

What does \s mean in regex?

\s stands for “whitespace character”. Again, which characters this actually includes, depends on the regex flavor. In all flavors discussed in this tutorial, it includes [ \t\r\n\f]. That is: \s matches a space, a tab, a carriage return, a line feed, or a form feed.

WHAT A *+ B mean in regular expression?

In normal regular expression grammar, (a+b)* means zero or more of any sequence that start with a , then have zero or more a , then a b .


Video Answer


1 Answers

\d is a digit (a character in the range 0-9), and + means 1 or more times. So, \d+ is 1 or more digits.

This is about as simple as regular expressions get. You should try reading up on regular expressions a little bit more. Google has a lot of results for regular expression tutorial, for instance. Or you could try using a tool like the free Regex Coach that will let you enter a regular expression and sample text, then indicate what (if anything) matches the regex.

like image 101
Mark Rushakoff Avatar answered Oct 21 '22 08:10

Mark Rushakoff