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\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])? 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -