I have a function that pulls urls out of a chunk of text and replaces them with links. What I would like to do is to have the look at the length of $1 and if it is over 64chars long, I would like to replace it with something like "link". I am just not sure how to approach this.
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(exp,"<a href='$1' target='_blank'>$1</a>");
Any ideas?