Hi all,
I'm looking for some help with validating a correctly formatted string to the UK National Insurance number format:
The basic format is : Two prefix letters, six digits and one suffix letter example. AB123456C
Often, the number is printed/entered with spaces to pair off the digits, like this: AB 12 34 56 C
Some specific rules for this format:
Neither of the first two letters can be D, F, I, Q, U or V. The second letter also cannot be O.
The prefixes BG, GB, NK, KN, TN, NT and ZZ are not allocated.
The suffix letter is either A, B, C or D
I've used the following custom pattern just to get the basic format covered: \p{L}\p{L}\d\d\d\d\d\d\p{L} but wondered if anyone could help 'fine-tune' this for me? Also if we could cater for potential spaces would be ideal.
Many thanks for any help/guidance. :)
Bjorn