我正在尝试验证以“http://”或“https://”开头的字符串。一些例子:
http://example.com -> 好
https://example.com -> 好
http:///example.com -> 错误
http://www.example.com -> 错误
https//example.com -> 错误
我有这个正则表达式,但效果不好:
str.match(/^(http|https):\/\/?[a-d]/);
......有什么帮助吗?