well, after trying that, i realized that my pregmatch regex is useless. it only restricts the string to something that has http:// in front of it, and since now, it puts http:// automatically, i can type anything on the website field, and it will accept. (almost anything, with a few exceptions) but if i put "asdfasdf" it will accept, you know? it does not require a .com or similar in the end.
i need a better regex, my current one is:
Code: Select all
function validsite($validsite)
{
return (preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $validsite));
}
i got it on google, but i needed one that accepts the following string format:
http:// (letters, numbers, dots, dashes, slashes, etc) dot (letters only, 2 or 3 digits) [like com, co, net, it, tk, i dont know if numbers are needed, i've only seen extensions with 2 or 3 characters, and no numbers, please correct me](and anything again, like whatever can come after the .com, or .co (.uk) or .net/extension.php?adads=asd&asdasd)
idk if im very clear, but i hope so!
thanks again