I’ve got the following JavaScript which matches and replaces URLS with html links, however I need this to exclude urls which end in .png|.jpg|.jpeg|.gif
text = text.replace(
/(\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|])/gim,
'<a href="$1" class="autolink" target="_blank">$1</a>'
);
You could just to a test before:
If you need to do multiple replacements, then you could use a custom replace function that checks the match against the image endings and acts accordingly. That would work like this: