Video Screencast Help

SIN (Canadian SSN) Validation Pattern

Created: 03 Oct 2012 | 2 comments

Running 10.0.0-7

Does a regular expression exist to validate a SIN (Canadian SSN) in content filtering?
There's not much point in using the basic regex as they block anything from 111-111-111 to 999-999-999 with zero validation.

I see a US SSN (Premium) pattern exists but not Canadian.

Here are some rules on SIN validation and a full perl example:


Discussion Filed Under:

Comments 2 CommentsJump to latest comment

oykunsatis's picture


There's no pattern for Canada SIN by default but you can create your own pattern also.

I found a regex like this maybe this can help you to validate.

\b[1-9]\d{2}[- ]?\d{3}[- ]?\d{3}\b

huntmknox's picture


Thanks, there actually is one by default. It works but has zero validation.
The dictionnary isn't an option either as the text used in it could be legitimate in my case, just that normally it wouldn't contain any SIN info.