Helpful Information
 
 
Category: Regex Programming
Getting a Number From a String

OK I have some text which usually looks like this below

"Sometext Othertext (xxx# 1234567)"

I want to extract the number so using REGEXP just get "1234567" when I do the check against the string above. Any ideas?

Thx in advance.

If those are the only digits then all you need is \d+. If not, append a (?=\)).

How do you code that in PHP?

Check out the manual page for preg_match

-Dan

Thx ........... worked like a charm










privacy (GDPR)