I am trying to match a simple domain: example.com
But all combinations of it.
How would I do this to cover:
https://example.com http://www.example.com etc.
^https?://([wd]+.)?example.com$
using code:
var result = /^https?://([a-zA-Zd-]+.){0,}example.com$/.test('https://example.com'); // result is either true of false
I improved it to match like "http://a.b.example.com"
1.4m articles
1.4m replys
5 comments
57.0k users