Bogdan Goie
Bogdan Goie

Reputation: 1297

What is the difference between \d+ and \d- OR \w+ and \w- in regular expression terms?

As per title, what is the difference between:

\d+ and \d- \w+ and \w-

in regular expression terms? What influence has + and - ?

Upvotes: 9

Views: 19347

Answers (1)

Toto
Toto

Reputation: 91385

\d+ means one or more digit [0-9] (depending on LOCALE)
\d- means a digit followed by a dash -

\w+ means one or more word character [a-zA-Z0-9_] (depending on LOCALE)
\w- means a word char followed by a dash -

Upvotes: 24

Related Questions