Regex to match urls using JavaScript -
i'm using regex far has been pretty good...
var r = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\s+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi; but if have string such following...
'<div>http://www.a-random-site.com/page1-blah-blah</div>another bit of text' then bit matched be...
http://www.a-random-site.com/page1-blah-blah</div>another how can alter regex take account angled bracked terminate link?
i edited saram's regex pattern , tested expresso , worked sample :
(?:http|ftp|https):\/\/[\w\-_]+(?:\.[\w\-_]+)+(?:[\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?