javascript - false returned when comparing 2 identically looking strings -


i use node.js script scraping , noticed 1 of strings scraped don't pass regex.regex isn't important here, string acts strange, here's example:

var scrapeddata = '1111 test1' var mydata = '1111 test1' scrapeddata === mydata  false 

now, if manually remove space between 1111 , test1 inside scrapeddata, , enter space, ok.

var scrapeddata = '1111 test1' // manually deleted , added space var mydata = '1111 test1' scrapeddata === mydata  true 

so guess scrapeddata contains hidden character breaks regex, might have encoding(utf-8 used) ? replaced single space character ' ' ?

maybe helps:

try using escape see actual char. example:

escape('1111 test1') 

should return "1111%20test1" if char space.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -