0

I am trying to use preg_match to match a number that's between 5 and 10 characters long. However, I want the ENTIRE number. I have

preg_match("/\d{5, 10}/", $str, $match)

but the above code will match the first 5 digits of a number that is let's say 10 characters long. How can I make it return the entire length of the number?

user2218567
  • 94
  • 1
  • 9

1 Answers1

1

The quantifier syntax is {x,y}, not {x,<space>y}.

preg_match("/\d{5,10}/", $str, $match) works just fine.

deceze
  • 471,072
  • 76
  • 664
  • 811