I was trying some things with regex’es and I was wondering how to do the following:
Accept:
http://google.com
https://google.com
http://google.com/
https://google.com/
http://google.com/*
https://google.com/*
http://*.google.com
https://*.google.com
http://*.google.com/
https://*.google.com/
http://*.google.com/*
https://*.google.com/*
The subdomain wildcard may only contain [a-z][A-Z][0-9] and is optional, but if it exists a dot after it is required.
I came as far as:
https?://(www.)google.com/
But I think this is not the right way to work… and only www. is usable.
I hope someone could give me the required result, and explains why it works that way.
Thanks,
Dennis
I think this might be what you’re after:
this site will help you validate your regular expressions. This seems to match what you want, but you may want to be more specific about the last part, as
.*matches literally anything.