Search

Validating a NINO using the Rule command

The XpressDox Rule command can be used to validate a NINO in a template.

 

You have a template which needs to capture and use a NINO (National Insurance Number) as described in NIM39110 – National Insurance Numbers. You would like to make sure that the value captured in the interview is a valid NINO.

This can be done using the following Rule command:

«Rule(NINO,soft,IsRegexMatch,'^[A-Z]{2}[0-9]{6}(A|B|C|D)$','The NINO  is of the wrong format, do you want to accept it anyway?')?Enter as two uppercase letters, 6 digits and either A, B, C, or D»

The soft option allows the user to enter an invalidly formatted number, but will issue a warning and ask the user if they want to accept the invalid number.

If you need to make sure that only valid numbers (according to the Rule) are accepted, then use the hard option, as follows:

«Rule(NINO,hard,IsRegexMatch,'^[A-Z]{2}[0-9]{6}(A|B|C|D)$','The NINO  is of the wrong format')?Enter as two uppercase letters, 6 digits and either A, B, C, or D»