Reputation: 5931
I use Node.js script for scraping and I noticed that one of the strings scraped simply don't pass the regex.Regex isn't important here, but the string which acts strange, here's the example:
var scrapedData = '1111 test1'
var myData = '1111 test1'
scrapedData === myData
false
Now, If manually remove space between 1111 and test1 inside scrapedData, and then enter space, everything is ok.
var scrapedData = '1111 test1' // manually deleted and then added space
var myData = '1111 test1'
scrapedData === myData
true
So I guess scrapedData
contains some hidden character that breaks my regex, it might have to do with encoding(utf-8 is used) ? Could it be replaced with single space character ' '
?
Upvotes: 0
Views: 49
Reputation: 176
maybe this helps:
try using escape to see the actual char. for example:
escape('1111 test1')
should return "1111%20test1" if the char is really a space.
Upvotes: 1