Regular Expressions 101

Community Patterns

Revenue Codes (Billing in US Healthcare)


Regular Expression
PCRE2 (PHP >=7.3)


Revenue codes are standardized numerical codes used in the healthcare industry to specify the type of service provided by healthcare facilities on patient billing statements. They help categorize and detail the services rendered for both inpatients and outpatients, allowing for accurate billing and reimbursement processes.

  • Typically four digits long.
  • Often start with a zero (e.g., 0120).
  • The last digit can indicate general services (0) or "other" services (9).

The codes are maintained by the US' National Uniform Billing Committee (

The regex really just matches 3 and 4 digit codes. It doesn't explicitly check that a 4 digit code starts with a 0 as, presumably, they increased the length to allow for longer codes (though looking online, it's hard to find 4 digit examples that don't start with 0).

It's worth noting therefore that this regex could match other code groups, such as 3 digit DRG codes and maybe 4 digit CPT codes.

Submitted by Richard Baxter - 2 months ago