需要regex来匹配像www.example.com
这样的html/text
-string链接,但是:
"www. some text after"
"www" only such as "some text before www some text after"
http
不匹配的链接\s
)或非字符开头,例如:" www.example.com"
或"www.example.com"
。我试过:
'/(^|\s)(www[^\s].[^<> \n\r \s]+)/iex'
但也与"www. some text after"
相匹配
发布于 2013-01-14 03:17:36
你在找
/(^|\s)(www[^<>\s]+)/
\s
包括\n
,\r
您也可以使用(?<=^|\s)(www\.[^<>\s.]+\.[^<>\s.]+)(?=\s|$)
https://stackoverflow.com/questions/14317398
复制相似问题