To be honest I had difficulties to understand what exactly you want, but I guess you mean that you have a text with various URLs inside and you don't want to match those which are included in a html img
tag. If so, try this:
/(?<!src\=\")(https?|ftp):\/\/(www\.)?([\w\-\.]+)\.([a-z]{1,5}+)\/?([\w\.\?\=\&\-\~\/\%\+\;]+)?(\#(\w+))?/
Notes: