Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Two same regex , different results

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading