Hi i need to detect and convert urls images and video from plain text urls
Html
<div id="content-url">
Hello World<br>
http://www.goalterest.com/ <br>
http://www.esotech.org/wp-content/uploads/2011/12/jquery_logo.png
http://www.esotech.org/wp-content/uploads
</div>
Jquery
var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var photoRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]).(?:jpg|gif|png)/ig;
var url_url= $('#content-url').html().match(urlRegex);
var url_photo= $('#content-url').html().match(photoRegex);
var convert_url='<a href="'+url_url+'">'+url_url+'</a>';
var convert_photo='<img src="'+url_photo+'" width="150" height="150" alt="Nba">';
$('#content-url').append(convert_url);
$('#content-url').append(convert_photo);
Here Demo http://jsfiddle.net/nqVJc/3/
In the demo i get the way to detect and convert to url and photo but the problem ist when ist there multiple urls The Urls are not separated