How to match a fixed number of digits with regex in PHP?
- by user198729
I want to retrieve the consecutive 8 digits out of a string.
"hello world,12345678anything else"
should return 12345678 as result(the space in between is optional).
But this should not return anything:
"hello world,123456789anything else"
Because it has 9 digits,I only need 8 digits unit.