I have plain text in a database and want any URL strings to be clickable when displayed. The URLs in the text can be in the form http://www.mysite.com, http://mysite.com, or www.mysite.com. The 'trick' is that many of the URLs are extremely long and I need the clickable part of the display to shorten the link to, say, 30 characters max.
<a href='http://mysite.com/wombats/stuff/show_me.php?this=6&that=7&furry=yes'>http://mysite.com/wombats ....furry=yes'></a>
I assume some preg wizardy can solve this, hence my post.
edit: these links are all offsite, so getting target='_blank' into the output would be a definite bonus.