Sri Lankan Data Patterns

Detection patterns for NIC, passports, bank accounts and more

Sri Lankan Data Patterns

This page provides comprehensive regex patterns for detecting sensitive Sri Lankan data types. These patterns are essential for implementing Data Loss Prevention (DLP) solutions and ensuring PDPA compliance.

How to Use

Click the Copy button next to any regex pattern to copy it to your clipboard.

National Identity Card (NIC) Numbers

Sri Lankan NIC numbers in old and new formats

Old NIC Format (Pre-2016)

Format: 9 digits followed by 'V' or 'X' (e.g., 123456789V)

Regular Expression:
^\d{9}[VvXx]$

Examples:

  • 123456789V
  • 987654321X

New NIC Format (2016 onwards)

Format: 12 digits (e.g., 199812345678)

Regular Expression:
^\d{12}$

Examples:

  • 199812345678
  • 200056789012

Combined Pattern (Both Formats)

Regular Expression:
^(\d{9}[VvXx]|\d{12})$

Passport Numbers

Sri Lankan passport number format

Sri Lankan Passport

Format: 1 letter followed by 7 digits (e.g., N1234567)

Regular Expression:
^[A-Z]\d{7}$

Examples:

  • N1234567
  • P9876543

Mobile Numbers

Sri Lankan mobile phone numbers

Standard Format

Format: 07X followed by 8 digits (e.g., 0771234567)

Regular Expression:
^0[7][0-9]{8}$

Examples:

  • 0771234567
  • 0761234567
  • 0701234567

International Format

Format: +94 followed by 9 digits (e.g., +94771234567)

Regular Expression:
^\+94[7][0-9]{8}$

Examples:

  • +94771234567
  • +94761234567

Bank Account Numbers

Sri Lankan bank account number formats

Standard Account Number

Format: 10-16 digits (varies by bank)

Regular Expression:
^\d{10,16}$

Examples:

  • 1234567890
  • 12345678901234

IBAN Format (Sri Lanka)

Format: LK followed by 2 check digits and bank code

Regular Expression:
^LK\d{2}[A-Z0-9]{4}\d{16}$

Example:

  • LK12BANK1234567890123456

Tax Identification Number (TIN)

Sri Lankan TIN format

TIN Format

Format: 9 digits (e.g., 123456789)

Regular Expression:
^\d{9}$

Examples:

  • 123456789
  • 987654321

Credit and Debit Card Numbers

International card number formats

Visa Card

Format: Starts with 4, 13 or 16 digits

Regular Expression:
^4\d{12}(?:\d{3})?$

Example:

  • 4532015112345678

Mastercard

Format: Starts with 51-55 or 2221-2720, 16 digits

Regular Expression:
^(?:5[1-5]\d{2}|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$

Example:

  • 5425233430109903

American Express

Format: Starts with 34 or 37, 15 digits

Regular Expression:
^3[47]\d{13}$

Example:

  • 371449635398431

General Card Pattern

Format: 13-19 digits, with optional spaces or hyphens

Regular Expression:
^\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4,7}$

Examples:

  • 1234 5678 9012 3456
  • 1234-5678-9012-3456
  • 1234567890123456

Email Addresses

Standard email address format

Email Format

Standard email address pattern

Regular Expression:
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Examples:

  • user@example.com
  • john.doe@company.lk
  • info@opendlp-lk.org

Additional Data Patterns

Other common Sri Lankan data patterns

Landline Phone Numbers

Format: Area code (2-3 digits) + 7 digits (e.g., 0112345678)

Regular Expression:
^0[1-9]\d{8}$

Examples:

  • 0112345678 (Colombo)
  • 0812345678 (Kandy)
  • 0912345678 (Galle)

Postal Codes

Format: 5 digits (e.g., 10100)

Regular Expression:
^\d{5}$

Examples:

  • 10100 (Colombo Fort)
  • 20000 (Kandy)
  • 80000 (Galle)

Vehicle Registration Numbers

Format: Province code + letters + numbers (e.g., WP CAB-1234)

Regular Expression:
^[A-Z]{2,3}[\s-]?[A-Z]{2,3}[\s-]?\d{4}$

Examples:

  • WP CAB-1234
  • CP ABC-5678
  • NP XYZ-9012

Business Registration Number (BRN)

Format: PV followed by numbers (e.g., PV00123456)

Regular Expression:
^PV\d{8}$

Example:

  • PV00123456

Implementation Guidelines

DLP Integration

Use these patterns in your DLP solution to detect and protect sensitive Sri Lankan data in transit and at rest.

PDPA Compliance

These patterns help ensure compliance with Sri Lanka's Personal Data Protection Act (PDPA) No. 9 of 2022.

Testing Required

Always test regex patterns with your specific data sets to ensure accuracy and reduce false positives.

Regular Updates

Keep patterns updated as data formats evolve. Contribute improvements via our GitHub repository.

Found an Issue or Have a Suggestion?

Help us improve these patterns! Contribute or report issues on our GitHub repository.

Report on GitHub