View Single Post
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-14-2012 , 19:27   Re: Regex pattern for hostnames
Reply With Quote #3

works, thanks
but how about when i write "www.google. com" or "www. address . com" i mean, those spaces/blanks

EDIT: ok i tried something and seems to work xD
PHP Code:
([a-z0-9\-]+\.|[a-z0-9\-]+\ )+[a-z]{2,4
but even if i write "ssssss.test" or "hahaha.go" it says it matches..

EDIT2:
finally got something like this, at first look seems alright but there is still the problem with the spaces..
PHP Code:
([a-z0-9\-]+\.|[a-z0-9\-]+\ )+(com|org|net|mil|info|edu|COM|ORG|NET|MIL|EDU|INFO
__________________


Last edited by anakin_cstrike; 03-14-2012 at 19:55.
anakin_cstrike is offline