Home > Back-end >  Two same regex , different results
Two same regex , different results

Time:02-17

console.log(/\d[x/ ‑]{1}‑$/.test('56 -'))
console.log(/\d[x/ -]{1}-$/.test('56 -'))

Two Regex seem totally same, but I get two different result in Chrome Console

enter image description here

why?

CodePudding user response:

There seems to be a difference in the - char between the two. They look very similar but if you check in this website you can see they have a different char code http://www.mauvecloud.net/charsets/CharCodeFinder.html

The one above is 8209 and the one below is 45

  • Related