February 17th, 2010, 11:07 AM
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.
February 17th, 2010, 12:12 PM
If those are the only digits then all you need is \d+. If not, append a (?=\)).
February 17th, 2010, 12:29 PM
How do you code that in PHP?
February 17th, 2010, 03:01 PM
Check out the manual page for [PHPNET="preg_match"]preg_match[/PHPNET]
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.
February 17th, 2010, 04:13 PM
Thx ........... worked like a charm