我希望能够匹配以下示例:
我有以下正则表达式,它不匹配
假设我有一个如下所示的字符串:
"I have found a lot of help off www.stackoverflow.com and the people on there!"
我想对该字符串进行匹配,并获得:
"www.stackoverflow.com"
谢谢!
www.example.com
http://example.com
https://example.com
我有以下正则表达式,它不匹配
www.
,但会匹配http://
https://
。我需要匹配上述示例中的任何前缀,并一直匹配到下一个空格为止,即整个URL。var regx = ((\s))(http?:\/\/)|(https?:\/\/)|(www\.)(?=\s{1});
假设我有一个如下所示的字符串:
"I have found a lot of help off www.stackoverflow.com and the people on there!"
我想对该字符串进行匹配,并获得:
"www.stackoverflow.com"
谢谢!
/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
。 - gcr15