javascript :: js_match
Library
Regex: URL Validation
Regex for javascript to validate an url;
var url = "http://www.test.com/testing"
var regex = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
if (regex.test(url))
{
window.alert("URL is Valid.");
}
else
{
window.alert("URL is invalid.");
}
var url = "http://www.test.com/testing"
var regex = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
if (regex.test(url))
{
window.alert("URL is Valid.");
}
else
{
window.alert("URL is invalid.");
}
Expression
Expression:
Attributes:
Match:
Some options are disabled and only available for members.
No reactions.