hostname regex help -


i have hostname regex i'd expand on bit. match hostnames such as:

yahoo.com

mail.yahoo.com

but match

&^%yahoo.com etc...

(\w+\.\w+\.\w+) 

can tell me need add allow letters, numbers , periods?

try using [a-za-z0-9\.]+ instead of \w+.

so in be:

([a-za-z0-9\.]+\.[a-za-z0-9\.]+\.[a-za-z0-9\.]+) 

Comments