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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -