BenW Posted July 31, 2019 Report Posted July 31, 2019 I have created a regex for Canadian SIN but I am getting false hits due to 0000 numbers. (\d{3}-\d{3}-\d{3})|(\d{3}\s\d{3}\s\d{3}) Quote
igor_r Posted August 1, 2019 Report Posted August 1, 2019 Hi BenW, Can you try this: ([1-9]\d{2}-\d{3}-\d{3})|([1-9]\d{2}\s\d{3}\s\d{3}) Quote
BenW Posted August 1, 2019 Author Report Posted August 1, 2019 0 is a valid number but not a string of zeros Quote
igor_r Posted August 2, 2019 Report Posted August 2, 2019 Hi BenW, According to this article http://id-check.artega.biz/info-ca.php, The first digit of a SIN indicates the province in which it was registered. Therefore any SIN number that starts with a zero would be fictitious. The regex that I provided earlier would ignore all SIN numbers that with a zero. That would also filter out a string zeros. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.