Posted on: 2011-04-17 16:54:05.000
Okay, I found an answer on Stack Overflow that works, I hope!
http://stackoverflow.com/questions/2177142/javascript-regex-to-replace-urls-with-links-but-not-in-embed-or-img-tagsLet’s see if that got replaced!
EDIT: It did. The regex code to find the match is:
(?:^|[^=])((ftp|http|https|file):\\/\\/[\\S]+(\\b|$))
and then it replaces with:
"< a href=’" $1 "’ >" $1 " < /a > "
Which is something like... don’t match if it starts with a = character (which the IMG tags use, eg IMG SRC=) but replace any kind of ftp, http, https, file type link with a link if it does match.
I don’t know. Regex makes my head hurt. But it seems to work ok.
Let’s see if
still works. It seems to.