I am trying to extract a substring from a text box input. The code is as follows
var re = /.*\$([0-9,\s]+).*Price/mi;
var comp = '02148$379,900Listed at Price3Beds2Baths1,245Sq.Ft.$305 / Sq. Ft.Built: 2006Cumulative: 26 daysOn Redfin: 26 days'
var comp1 = @Text;
var m = comp.match(re);
the output of m is 379,900, and is correct for the hard coded string comp. However, when I input the same string into the text box @Text in my app, and switch comp.match(re) to comp1.match(re) in the code above, I receive the error
Script Error: Type Error Cannot read property '1' of null
Please sign in to leave a comment.