REGEX Queries (RSA ID Number)

Showing results for 
Show  only  | Search instead for 
Did you mean: 

REGEX Queries (RSA ID Number)

L0 Member

Hi All,

Hope someone is able to help. I have no experience with regex

South African ID Number are a 13 digit number incorporating date of birth, gender, citizenship and there is a check digit at the end to vilidate the number.

I am looking for a way to vailidate these ID numbers.

For example my ID number is 7902275404184

The first 6 numbers are date of Birth YYMMDD

The 7th digit specifies gender 0-4 - Female 5-9 - Male

The next 3 digits (8-10) are sequence numbers and are anything from 000-999

The 11th digit is citizenship 0 - RSA Citizen, 1 - Non-Citizen

Digit 12 was used for race but this is now null and void so this would be anything from 0-9

And this is where things start to get interesting the last digit (13) is the valiidation check.

The web site below explains how this is checked against the preceding 12 digits

Is regex able to do this type of validation?

I have found a couple of pre-built regex queries but none of them vailidate the ID number.




L4 Transporter


The Paloaltonetworks firewalls do pattern matching but do not do REGEX Validation. If this is an important feature I would like to redirect you to your local SE so you can request a feature enhancement for future versions of the product.



  • 1 replies
  • 101 Subscriptions
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!