Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Identity
#sin
#canada
#ca
#identity

Canadian SIN

Validates Canadian Social Insurance Numbers (SIN): 9 digits optionally formatted as NNN-NNN-NNN.

✓ Canadian payroll systems✓ Government service portals✓ Tax form validation
/
/
Safe
Test String
4 matches
[…]{3}Character class […]— Matches any single character listed in this set — repeated exactly 3 times · {3} — exactly 3 times
0-90-9— 0-9 — range from '0' to '9'
[…]?Character class […]— Matches any single character listed in this set — repeated zero or one time (optional) · ? — zero or one time (optional)
\sspace— \s — whitespace (space, tab, newline…)
\-\-— \- — escaped character
[…]{3}Character class […]— Matches any single character listed in this set — repeated exactly 3 times · {3} — exactly 3 times
0-90-9— 0-9 — range from '0' to '9'
[…]?Character class […]— Matches any single character listed in this set — repeated zero or one time (optional) · ? — zero or one time (optional)
\sspace— \s — whitespace (space, tab, newline…)
\-\-— \- — escaped character
[…]{3}Character class […]— Matches any single character listed in this set — repeated exactly 3 times · {3} — exactly 3 times
0-90-9— 0-9 — range from '0' to '9'
Pattern: 38 charsInput: 45 chars
100% client-side · private

✓ Valid Examples

  • 046-454-286
  • 046454286
  • 123 456 789
  • 900-000-000

✗ Invalid Examples

  • 12345678
  • 1234567890
  • abc-def-ghi
  • 046-454-28

Usage & Integration

Validate Canadian SIN natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('ca-sin', '...');

Python

from regexto_validators import validate

validate("ca-sin", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("ca-sin", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('ca-sin', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("ca-sin", "...").unwrap();