Javascript and PHP Regular Expression for url validation -
Javascript and PHP Regular Expression for url validation -
possible duplicate: regular look url validation (in javascript)
so i've seen many similar questions , answers can't find solution fits specific needs.
i'm terrible @ regex's , struggling simple regex next url validation.
domain.com domain.com/folder subdomain.domain.com subdomain.domain.com/folder
also validate optional http:// , http://www. super helpful. thanks!
as near can be:
/[a-z]+:\/\/(([a-z0-9][a-z0-9-]+\.)*[a-z][a-z]+|(0x[0-9a-f]+)|[0-9.]+)\/.*/
note question hasn't limited urls set of protocols, tlds or character sets.
something skype://18005551212
or gopher://localhost
valid url. heck, depending on you're using browse, next might valid ways same server (though not quite same virtualhost):
they work me in firefox.
if want farther restrictions, determine are. willing sacrifice valid protocols? interested in 1 or 2 protocols?
a more specific question more specific answer.
php javascript regex
Comments
Post a Comment