regex - Javascript regular expression for URL -


can me building regular expression extract couple of urls using regular expressions below string

'<a href="http://mydmncd.app.corp:8080/ag/ps?q=c~0~0~0~0~0~v2hgsds4-0ds43hg~94~0~~~1~0~0~~http%3a%2f%2fnghj.com" target="_blank"><img border=0    src="mydmncd.app.png" alt="" clickurl="http://mydmncd.app2.corp?q=1&f=4"/></a>' 

url starts http://mydmncd , remaining part may vary. have extract url until find double quotes. in above example have extract http://mydmncd.app.corp:8080/ag/ps?q=c~0~0~0~0~0~v2hgsds4-0ds43hg~94~0~~~1~0~0~~http%3a%2f%2fnghj.com

i tried regex /[http://mydmncd].*"/g matching last double quotes. have tried /[http://mydmncd].*\s/g no luck.

see jsfiddle

the problem .* matches ".

you should able replace .* [^\"]* match character except ".

i don't have way test here, hope can you.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -