I am programming a website, where users can write reviews. However the user shall not be allowed to insert any kind of link or url advertisment to another page. I tested many cases like
Hey, also check out my page on www . mywebsit . com
Hey, also check out my page on http://abcdMywebsite.com
with the following regex :
jQuery.validator.addMethod("stringHasUrl", function(val, elem) {
var regex = new RegExp("(http|https|ftp|ftps|www|href)","i");
if(regex.test(val)){
return false;
}else{
return true;
}
}, "");
It basically works. But I am not sure if I am missing anything. Are there other pattern, that I should add?
Thanks!