|
|
|
|
|
|
|
#2774 |
Tuesday, June 10, 2008 Posted by RP
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 and Advices
No answer posted yet
|
| |
|
| |
|
|
|
|