I want regex to match web addresses such as http://www.example.com
, example.co.uk
, en.example.com
etc. I've been using ^(https?://|www\.|)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$
and testing it on http://regexpal.com/, and it seems to work exactly as it should.
However, when I put it in autohotkey, it seems to match extra things like example
and example.something
, when it shouldn't. It then doesn't match things like example.com/something
and example.com/something.html
when it should.
If RegExMatch(Clipboard, "^(https?://|www\.|)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$")
Msgbox, it matches
else
Msgbox, it doesn't