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

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -