Hey guys. Right now I have this regex on my PHP app:
$regex = '#^(www\.)*([^www][a-z0-9-]+)\.tanlup\.local$#';
Here is what I need it to do:
MATCH www.something.tanlup.local
MATCH something.tanlup.local
NOT MATCH www.tanlup.local
NOT MATCH tanlup.local
The problem is that when I have a subdomain starting with a “w”, it doesn’t match! Does anyone knows why and how could I make it better?
Thanks!
Building overly complex regular expressions for one-off situations like this is self-defeating. You might have better luck building a very generic regular expression and black listing certain domains: