I've several strings that contains a single phone number in it in the format of 1112223333. Each string and each number is different. How would I pull this number out using regular expression? I believe the pattern would be \d{10} but I'm not completely sure on that. What function will return the single 10 digit number from the string? Thanks
You already know the right way. Check following code.. $str = 'Hi, My number is 1234567890 and i am also reachable at 4567891230'; preg_match_all('/\d{10}/', $str, $matches); print_r($matches); PHP:
Excellent... I was getting all the preg functions mixed up and what not. That was the one. Thanks tons!