Regular Expressions 101

Community Patterns

Current Procedural Terminology (CPT) codes, incl optional modifiers

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^\d{4}[a-zA-Z0-9](-[a-zA-Z0-9]{2})?$
/
gm

Description

CPT is a uniform coding system consisting of descriptive terms and identifying codes used primarily to identify medical services and procedures furnished by physicians and other health care professionals for which they bill public or private health insurance programs. It is a numeric coding system maintained by the American Medical Association (AMA). CPT codes can be subdivided into 3 levels/categories (not to be confused with HCPCS Level II!):

  • Category I: Evaluation & Management Services, Anesthesia, Surgery, Radiology, Procedures, Pathology & Laboratory Procedures, and Medicine Services & Procedures. All 5 characters are numeric.
  • Category II: Optional, but provide extra information about additional procedures typically performed with Category I CPT Codes, for example 3008F is “Body Mass Index (BMI) documented” which occurs during the Evaluation & Management Services. First 4 digits numeric, followed by an “F”.
  • Category III: Describe emergent or experimental services that help providers and government agencies track efficacy of those medical techniques. They may become Category I but have an expiration of 5 years. First 4 digits are numeric, followed by any other letter. This regex matches codes with optional modifiers:- "A medical coding modifier is two characters (letters or numbers) appended to a CPT® or HCPCS Level II code. The modifier provides additional information about the medical procedure, service, or supply involved without changing the meaning of the code. Medical coders use modifiers to tell the story of a particular encounter." (https://www.aapc.com/resources/what-are-medical-coding-modifiers) There is another pattern in regex101 that does not match codes with such modifiers
Submitted by Richard Baxter - 17 days ago (Last modified 17 days ago)