所以这是我到目前为止所得到的:
(?<=\s|\b)https?://[^ ]+(?<!jpe?g|png|bmp|gif)(?=\s|\b)
问题是,它与此匹配:
http://imgur.com/test/img.jpg
(直到img)。我希望它不返回任何匹配。
基本上,这些应该匹配:
http://test.com/index.html
https://anything.net/this
check out this link: https://anything.net/this it's really cool
这些不应该匹配:
http://imgur.com/ixmas.jpg
http://example.com/testdirectory/rawr-gif.gif
testhttp://example.com/rawr