node.js - JavaScript/Node match returns null -


i want out of string containing html code, 1 value. therefore trying following:

var test = '<div class="market_listing_largeimage"><img src="someurlhere" alt="" /></div>'; var test2 = test.match('<div class="market_listing_largeimage"><img src="' + '(.*)' + '" alt="" /><</div>'); 

my problem returns null. googling last hour, trying different examples, worked string provided in example, somehow, doesn't work me. doing wrong?

you have additional < in code.

this should work:

var test = '<div class="market_listing_largeimage"><img src="someurlhere" alt="" /></div>'; var test2 = test.match('<div class="market_listing_largeimage"><img src="' + '(.*)' + '" alt="" /></div>'); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -