Title: Mr
Name: Vitor Santos
Date: 2/21/2025 9:56:22 AM
Comment:
PX488179C
Title: mr
Name: max abel
Date: 10/4/2023 12:32:23 PM
Comment:
ZX047829C
Title: More complete regex
Name: CugeDe
Date: 2/26/2018 4:19:29 PM
Comment:
[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}\s?[0-9]{2}\s?[0-9]{2}\s?[0-9]{2}\s?[A-DFMP ]
Title: Don't use the above regex
Name: Joe
Date: 3/22/2016 6:45:14 AM
Comment:
As Simon mentioned the original regex is wrong for a number of reasons and should not be used. Below is better but doesn't check for administration numbers.
^[ABCEGHJKLMNOPRSTWXYZabceghjklmnoprstwxyz][ABCEGHJKLMNPRSTWXYZabceghjklmnprstwxyz][0-9]{6}[A-D\sa-d]{0,1}$
Useful links.
http://www.hmrc.gov.uk/schemas/core-v2-0.xsd
http://www.hexcentral.com/articles/validate_ni.htm
http://www.hmrc.gov.uk/MANUALS/nimmanual/nim39110.htm
Best Regards,
Joe
Title: Final character is NOT optional
Name: Constance Reader
Date: 10/12/2012 5:32:52 AM
Comment:
It's not completely correct to say "the final letter is optional". The NINO is always exactly nine characters. The last one is either a letter or a space, but is always present. In other words, if the letter is absent, you can't trim the number back to eight characters.
Source: http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards/identifiers/national_insurance_number.aspx (points 1 and 4).
Another useful reference: http://www.hexcentral.com/articles/validate_ni.htm
Also, the use of F or M as the final character is now deprecated. Although some NINOs still exist with these suffixes, they will be rejected in electronic submissions.
Title: Final character is NOT optional
Name: Constance Reader
Date: 10/12/2012 4:56:08 AM
Comment:
It's not completely correct to say "the final letter is optional". The NINO is always exactly nine characters. The last one is either a letter or a space, but is always present. In other words, if the letter is absent, you can't trim the number back to eight characters.
Source: http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards/identifiers/national_insurance_number.aspx (points 1 and 4).
Another useful reference: http://www.hexcentral.com/articles/validate_ni.htm
Also, the use of F or M as the final character is now deprecated. Although some NINOs still exist with these suffixes, they will be rejected in electronic submissions.
Title: Final character is NOT optional
Name: Constance Reader
Date: 10/12/2012 4:29:04 AM
Comment:
It's not completely correct to say "the final letter is optional". The NINO is always exactly nine characters. The last one is either a letter or a space, but is always present. In other words, if the letter is absent, you can't trim the number back to eight characters.
Source: http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards/identifiers/national_insurance_number.aspx (points 1 and 4).
Another useful reference: http://www.hexcentral.com/articles/validate_ni.htm
Also, the use of F or M as the final character is now deprecated. Although some NINOs still exist with these suffixes, they will be rejected in electronic submissions.
Title: Final character is NOT optional
Name: Constance Reader
Date: 10/12/2012 4:26:32 AM
Comment:
It's not completely correct to say "the final letter is optional". The NINO is always exactly nine characters. The last one is either a letter or a space, but is always present. In other words, if the letter is absent, you can't trim the number back to eight characters.
Source: http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards/identifiers/national_insurance_number.aspx (points 1 and 4).
Another useful reference: http://www.hexcentral.com/articles/validate_ni.htm
Also, the use of F or M as the final character is now deprecated. Although some NINOs still exist with these suffixes, they will be rejected in electronic submissions.
Title: Final character is NOT optional
Name: Constance Reader
Date: 10/12/2012 4:26:09 AM
Comment:
It's not completely correct to say "the final letter is optional". The NINO is always exactly nine characters. The last one is either a letter or a space, but is always present. In other words, if the letter is absent, you can't trim the number back to eight characters.
Source: http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards/identifiers/national_insurance_number.aspx (points 1 and 4).
Another useful reference: http://www.hexcentral.com/articles/validate_ni.htm
Also, the use of F or M as the final character is now deprecated. Although some NINOs still exist with these suffixes, they will be rejected in electronic submissions.
Title: "N" is permitted as first character
Name: Paul Russell
Date: 8/30/2011 12:42:44 PM
Comment:
^[A-CEGHJ-NPR-TW-Za-ceghj-pr-tw-z]{1}[A-CEGHJ-NPR-TW-Za-ceghj-npr-tw-z]{1}[0-9]{6}[A-DFMa-dfm]{1}$
Title: "N" is permitted as first character
Name: Paul Russell
Date: 8/30/2011 12:37:55 PM
Comment:
^[A-CEGHJ-NPR-TW-Za-ceghj-pr-tw-z]{1}[A-CEGHJ-NPR-TW-Za-ceghj-npr-tw-z]{1}[0-9]{6}[A-DFMa-dfm]{1}$
Title: "N" is permitted as first character
Name: Paul Russell
Date: 8/30/2011 12:37:10 PM
Comment:
^[A-CEGHJ-NPR-TW-Za-ceghj-pr-tw-z]{1}[A-CEGHJ-NPR-TW-Za-ceghj-npr-tw-z]{1}[0-9]{6}[A-DFMa-dfm]{1}$
Title: Case change
Name: Michael Barclay
Date: 6/11/2010 10:17:17 AM
Comment:
^[A-CEGHJ-PR-TW-Za-ceghj-pr-tw-z]{1}[A-CEGHJ-NPR-TW-Za-ceghj-npr-tw-z]{1}[0-9]{6}[A-DFMa-dfm]{1}$
Although not technically correct that NI numbers could be in lowercase this caters for that scenario, also I believe (from HRM website), you have to have 1 letter at the end
Title: HMRC Version
Name: Greatness
Date: 2/18/2010 8:18:39 AM
Comment:
Simon is correct, NINO validations should match what HMRC says it is -- http://www.hmrc.gov.uk/MANUALS/nimmanual/nim39110.htm
Title: HMRC Version
Name: Greatness
Date: 2/18/2010 8:10:27 AM
Comment:
Simon is correct, NINO validations should match what HMRC says it is -- http://www.hmrc.gov.uk/MANUALS/nimmanual/nim39110.htm
Title: Upper and lower case
Name: Stephen D
Date: 12/3/2009 8:08:19 AM
Comment:
hey i used the regular expression for the input on a form but my clients have came back and asked could it be converted in to uppercase automatically. i used a style text-transform:uppercase and it does display it all in upper case, however it must still be reading it in as lower case because i still get an error message when i enter with out the caps lock on, despite displaying in upper on the form. how would i edit this expression to include both upper and lower?
Title: NI NI no
Name: breenbob
Date: 11/4/2009 6:19:25 AM
Comment:
I live in Northern Ireland (part of the UK) and my OWN national insurance number starts NI. This makes your second letter rule invalid!
Title: HMRC Version
Name: Simon
Date: 9/11/2009 12:14:34 PM
Comment:
The HMRC have a schema that can be found at http://www.hmrc.gov.uk/schemas/core-v2-0.xsd
It includes their versions of NINO (as well as many others) that as far as I believe they use to validate submissions against.
Their NINO:
[ABCEGHJKLMNOPRSTWXYZ][ABCEGHJKLMNPRSTWXYZ][0-9]{6}[A-D ]
Might be worth allowing for spaces and splitting up the [0-9]{6} into three lots of [0-2]{2}[\s]{0,1} or similar as per Neil's post.
Title: HMRC Version
Name: Simon
Date: 9/11/2009 12:14:06 PM
Comment:
The HMRC have a schema that can be found at http://www.hmrc.gov.uk/schemas/core-v2-0.xsd
It includes their versions of NINO (as well as many others) that as far as I believe they use to validate submissions against.
Their NINO:
[ABCEGHJKLMNOPRSTWXYZ][ABCEGHJKLMNPRSTWXYZ][0-9]{6}[A-D ]
Might be worth allowing for spaces and splitting up the [0-9]{6} into three lots of [0-2]{2}[\s]{0,1} or similar as per Neil's post.
Title: dfg
Name: dfgdfg
Date: 3/6/2008 5:29:48 AM
Comment:
dfgdfgdf
Title: Needs to allow for spaces
Name: Neil
Date: 4/27/2007 9:19:04 AM
Comment:
Subject to context you may wish to allow for spaces between the letters and pairs of numbers.
So:
^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}\s?[0-9]{2}\s?[0-9]{2}\s?[0-9]{2}\s?[A-DFM]{0,1}$
Does this. I don't know of an elegant way to repeat \s?[0-9]{2} three times - I'm sure somebody else does!
Re Rob's comment - V is actually not allowed so the regex is correct. Z is allowed. (I'll burn the anorak now)
Title: broken
Name: Rob
Date: 8/26/2005 4:16:42 AM
Comment:
Both parts don't allow 'V' although the description says nothing about 'V' not being allowed. The second part says 'Z' is not allowed, but it is allowed through.