Website RegEx pattern


How can I make a reguluar expression pattern which accepts websites only but includes all type of website domains, e…g [dot]online, [dot]co, [dot]com, http, https, etc…

I tried below but it’s not working with many domains




Try this: (The following regex is written for a text editor, not JS.)


Samples: matches are yellow, not matched are not colored.

IF you cannot work with this, then supply a full range of samples showing exactly what you need to capture and what to do not wish to capture.

[off topic]
My knowledge of regex is severely limited and if Php was available I would use:


What am I missing?
[/Off topic]

Replaced incorrect session with server.

Is this for client side validation of an input? You could just use type="url" in that case.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.