RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find South African ID Number Validity
Expression
(((\d{2}((0[13578]|1[02])(0[1-9]|[12]\d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]\d|30)|02(0[1-9]|1\d|2[0-8])))|([02468][048]|[13579][26])0229))(( |-)(\d{4})( |-)([01]8((( |-)\d{1})|\d{1}))|(\d{4}[01]8\d{1}))
Description
Matches valid South African ID numbers based on all criteria (except of course the checksum digit at the end). Matches the format defined as: YYMMDDSSSSCAZ. YY - Year, MM - Month, DD - Day, SSSS - Gender, C - Denotes citizenship (0 or a 1), A - Always an 8, Z - Checksum digit (doesn't validate if the checksum itself is valid). Also supports the following ways of entering it: YYMMDDSSSSCAZ | YYMMDD SSSS CAZ | YYMMDD SSSS CA Z . See this for a reference: https://www.westerncape.gov.za/general-publication/decoding-your-south-african-id-number-0
Matches
9202204720082 | 920220 4720 082 |920220 4720 08 2 | 920220-4720-082 | 920220-4720-08-2 9202204720183 | 920220 4720 183 | 920220 4720 18 3 | 920220-4720-183 | 920220-4720-18-3
Non-Matches
9202204720282 | 920220 4720 052 | 920220 4720 05 2 | 920220-4720-252
Author Rating: The rating for this expression. Rudi van Biljon
Source Rudi van Biljon
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials