I need a simple JavaScript regex that will validate all of the following
http://example.com
https://example.com
example.com
*.example.com
https://example.com
http://*.example.com
https://*.example.com
I use .com here by way of example but it could well be something else
but not, for example, https://*example.com. I thought the following
/((https?:\/\/)?([*]\.)?[a-z0-9_-]+(\.[a-z0-9_-]+)+\.?)/gi
might do the trick. It does, almost. The trouble is it passes `http://*example.com'. I fail to see why this is happening. Admittedly, regexes are not quite my forte.