Page 1 of 1

Match domain and subdomain

Posted: Fri Feb 19, 2010 9:20 am
by klevis miho
I have this regex: '#^([a-zA-Z0-9-]+)\.([a-zA-Z0-9-]+)\.([a-zA-Z0-9-]+)$#'
that matches subdomains, but I also want to match domains.

I will appreciate any tip.

Re: Match domain and subdomain

Posted: Wed Mar 03, 2010 9:14 am
by klevis miho
I found the solution by myself:

'#(([a-zA-Z0-9-]+)\.)*([a-zA-Z0-9-]+)\.([a-zA-Z0-9-]+)#'