Queryspace - Regex help
 
     
 Home > Computers and Internet
Previous Next


RP

Open Question

Jun 10, 2008, 8:45 am
Regex help 
I have been trying to get this to work and it doesn't work for some reason:

Code:

if (preg_match("\b[http://]*[A-Z0-9.-]+\.[A-Z]{2,4}\b", "PHP is the web scripting language of www.example.com choice.")) {
echo "A match was found.";
} else {
echo "A match was not found.";
}

It's suppose to find "www.example.com" in the string. It should also be able to find "http://www.example.com" and "example.com" but it doesn't.

Any help is appreciated. 

   
   

Answers  (0)

- No answers posted yet -