21

I cannot find a definitive guide to icd9 code formats.

Can anyone explain the format - especially the use of trailing and leading zeros?

A C# regex for icd9 and icd10 codes would also be nice.

Thanks!

2
  • Are you looking for fully qualified codes, or are incomplete codes also allowed in your application? Apr 8, 2011 at 6:41
  • 1
    Just a note: using regex for ICD only validates it is in the correct pattern. It does not ensure that the code exists! Consult CMS code lists for all possible ICD9 and ICD10 codes.
    – cacti5
    Apr 12, 2018 at 21:31

4 Answers 4

34

I was looking for the same thing and found what I believe to be a more complete answer. Thought I'd help anyone else coming in the future.

ICD-9 Regex

The ICD 9 format has a bunch of ways it can be formatted. It can begin with V, E, or a number.

  • If it begins with V, then it has 2 numbers, a decimal, then up to two numbers
    • Examples: V10.12 and V12
  • If it begins when E, then it has 3 numbers, the decimal place, then up to two numbers
    • Examples: E000.0 and E002
  • If it begins with a number, then it is up to 3 numbers, a decimal, then up to two numbers
    • Examples: 730.12 and 730

A good regex that checks all these rules is (Credit goes to sascomunitt)

^(V\d{2}(\.\d{1,2})?|\d{3}(\.\d{1,2})?|E\d{3}(\.\d)?)$

ICD-10 Regex

According to www.cms.gov ICD-10 has the following rules:

  • 3-7 Characters
  • Character 1 is alpha (cannot be U)
  • Character 2 is numeric
  • Characters 3-7 are alphanumeric
  • After 3 characters you use a decimal
  • Use of dummy placeholder "x" (This is the only one I am not accounting for in my regex...)
  • Alpha characters are not case sensitive

Here is the regex I came up with:

^[A-TV-Z][0-9][A-Z0-9](\.[A-Z0-9]{1,4})?$

Note These regexes are for javascript and may need tweaked for C# (I'm too lazy to test it right now)

9
  • Thanks! this is a better answer than the accepted one since it includes E Codes and V Codes. Only annoying thing is this us government form I'm writing a program for requires the '.' after the first three numbers, so lame! Feb 12, 2013 at 20:00
  • 1
    Technically, the character "U" is valid. It's been reserved for future use by the WHO, but is a valid character. Reference Jun 1, 2015 at 12:55
  • according to the link you have for ICD-9 the correct regex is ^([V\d]\d{2}(\.\d{1,2})?|E\d{3}(\.\d)?|\d{2}(\.\d{1,2})?)$ because in the last section he states ` Note that ICD-9 procedure codes are different yet again--these move the decimal up a place.`
    – abc123
    Jun 8, 2015 at 19:05
  • Works ok for most; but some icd 9 begining with V match both regexes.Examples :V01, V01.0, V01.1, V01.2, V01.3
    – Pete_ch
    Oct 16, 2015 at 20:32
  • 1
    For ICD9/10 duplicate codes, see: icd10data.com/ICD10CM/Duplicate_Codes
    – jjwdesign
    Dec 19, 2016 at 16:24
10

An ICD-9 code looks like this:

  • two/three-digit numeric code (may have leading zeroes to pad to three digits)
  • an optional dot
  • if that dot is present, there will be one or two following digits, depending on the preceding three digits. Which digits are allowed specifically is very variable.
  • Some codes are prefixed by an E or V.

An ICD-10 code looks like this:

  • an uppercase ASCII letter (A-Z)
  • two digits
  • an optional dot
  • if that dot is present, there will be one or two following digits. Again, it's highly variable which ICD codes allow for which digits after the dot.
  • Sometimes, you'll find an asterisk, a plus sign (at least in ASCII texts), or an exclamation point after a code. They are used in certain combination codes.

So, in essence, you could use regex to find ICD codes in a text, but you won't be able to validate them.

A C# regex for ICD-9 codes could look like this: @"\b[EV]?\d{2,3}(?:\.\d{1,2})?\b".

For an ICD-10 code: @"\b[A-Z]\d{2}(?:\.\d{1,2})?\b[*+!]?"

3
  • What are the rules for trailing zeroes? I thought I've seen 2 digit codes without the leading zero.
    – mson
    Apr 8, 2011 at 12:04
  • Tim is correct, there are codes with only 2 digits prior to the dot, such as 00.12 and 99.75. These are just 2 examples. There are many more.
    – fooMonster
    Jul 5, 2011 at 16:30
  • See Section 1-B-3 for more details on coding format: cdc.gov/nchs/data/icd/icd9cm_guidelines_2011.pdf That document states that ICD-9 diagnosis codes should be 3, 4, or 5 characters long. This section actually says 'digits' not 'characters' but this is obviously incorrect as one of the subsequent sections refers to V and E codes as @lecrank mentioned. Aug 28, 2014 at 19:45
1

Are you referring to ICD-9 diagnosis codes? Then see this thread: ICD-9 Code List in XML, CSV, or Database format.

1

There are 2 types of ICD 9 codes: Diagnosis Codes & Procedure Codes

for the Diagnosis Codes Gordon Tucker has the correct answer:

^(V\d{2}(\.\d{1,2})?|\d{3}(\.\d{1,2})?|E\d{3}(\.\d)?)$

ICD-9-CM procedure codes are 2 numbers, a decimal, then up to two numbers (to be a complete code 2 numbers are required)

A regex for these codes would be:

^\d{2}.\d{1,2}$

ICD-9-CM Procedure Codes 2012 ICD-9-CM Diagnosis Codes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.