If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
I needed to get a domain name with out any subdomains or tld for bacon 100%. after a bit of trail and error
//body of domain ex: iam.bacon.com we want bacon
$domainBody=preg_replace(’/^[a-z0-9.-]*?[.]{0,1}([a-z0-9-]*?)\.[a-z.]{2,6}$/i’,”$1″,$serverHost);
I tested on the following domains locally
www.frameword.sid
framework.sid
am.i.a.sub.domain.y.o.u.b.e.t.framework.sid.me
am.i.a.sub.domain.y.o.u.b.e.t.framework.sid
I’d think it’d be pretty simple to change the regex to get the full domain, just move \.[a-z]{2,6} in to the subsearch - is that even what you call it
Might Be Related




