validating internet address in javascript [duplicate]
Possible Duplicate:
how can i validate a url in javascript using regular expression
I want to validate whether user input a valid internet adress like www.hotmail.com http://www.abc.com.pk
Here's the js function:
function validateString(regexPattern, testString) {
var regexObj = new RegExp(regexPattern);
return regexObj.test(testString);
}
Finding the regex for URLs is just a matter of typing it in google. Here's a good one I've used before.
精彩评论