You may use some non-well-known regex power:
<img[^>]*>(*SKIP)(*FAIL)|https?://[^/s]+/S+.(?:jpg|png|gif)
Let's explain the pattern a bit:
<img # match a literal <img
[^>]* # match anything except > zero or more times
> # match a literal >
(*SKIP)(*FAIL) # make it fail
| # or
https? # match http or https
:// # match a literal ://
[^/s]+ # match anything except white-space and forward slash one or more times
/ # match a literal /
S+ # match a non-white-space one or more times
. # match a literal dot
(?:jpe?g|png|gif) # match jpg, jpeg, png, gif
# Don't forget to set the i modifier :)
The idea is to match the img
tag and skip it, meanwhile match all those URI's.
Online demo
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…