This is a Regex for South African ID numbers.
SA ID numbers' format is the following:
YYMMDD GGGG CAZ
YYMMDD is for the year, month and day.
GGGG is for Gender: 0000-4999 is female; 5000-9999 is male.
C is for Citizenship: 0 is born in SA and 1 is permanent residency.
A is always 8, was used until the late 1980's to indicate race.
Z is a strategically calculated number making the ID number valid or invalid using Luhn's algorithm.
This Regex also makes provision for spaces (people write ID numbers differently):
1234567890123
123456 7890 123
123456 7890 12 3
This Regex is also elsaticsearch compatible, I have test it in a lot of search engines, and it works every time.
Feel free to use this Regex.