Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

preg_match (URL) "OK" with or without "WWW"

Status
Not open for further replies.

webdev007

Programmer
Sep 9, 2005
168
Some URLs are built without www
I have this:
(I separated slashes and counter slashes for they could be misinterpreted as a W in my post)
if (!preg_match("/^[a-zA-Z0-9]+[:\ / \ /]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i",$this->url_preg=$url_preg) )

as is the second set of alphanumeric check for www.
^[a-zA-Z0-9]+[:\ / \ /]+[A-Za-z0-9\-_]
I cannot figure how making it ok in both cases with or without www
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top