I have regex expression (1) which matches the URL specified below. However I have problem creating a regex for input URL (see not matching). Any ideas how to do this on regex where user can input a URL with combination of http, https or www or even without these three but will still match the URL?
(1)
^(http|https)://www.example.com
(1) Matches
http://www.example.com
https://www.example.com
Not Matching
http://example.com
https://example.com
Should Match
http://www.example.com
https://www.example.com
http://example.com
https://example.com
example.com
www.example.com.