US DEA Number (Drug Enforcement Administration) Regex for JavaScript
/^[ABCDEFGHJKLMNPQRSTUX][A-Z9][0-9]{7}$/What this pattern does
This page provides a well-structured, multi-part regular expression for matching us dea number (drug enforcement administration), ported and verified for JavaScript. Identity and credential patterns need both correctness and safety, since they're frequent targets for adversarial input. The snippet below is ready to drop into your JavaScript project — whether you're validating in an Express middleware, a Next.js API route, or a client-side form.
Javascript Implementation
// US DEA Number (Drug Enforcement Administration)
// ReDoS-safe | RegexVault — Identity & PII > Health Identifiers
const usDeaNumberDrugEnforcementAdministrationRegex = /^[ABCDEFGHJKLMNPQRSTUX][A-Z9][0-9]{7}$/;
function validateUsDeaNumberDrugEnforcementAdministration(input: string): boolean {
return usDeaNumberDrugEnforcementAdministrationRegex.test(input);
}
// Example
console.log(validateUsDeaNumberDrugEnforcementAdministration("AB1234563")); // trueTest Cases
Matches (Valid) | Rejects (Invalid) |
|---|---|
AB1234563 | A12345678 |
AC1234568 | AB123456 |
BS1234568 | AB12345678 |
| — | ZB1234563 |
When to use this pattern
This pattern is drawn from the Identity & PII > Health Identifiers category and carries a ReDoS-safe certification. That matters for JavaScript developers because especially critical in long-running Node.js event loops where a ReDoS vulnerability can block the entire process. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.
Common Pitfalls
Verify the checksum — structurally valid DEA numbers with wrong checksums are commonly found in prescription fraud. First letter: A=hospital/clinic, B=pharmacy, C=practitioner, D=teaching hospital, E=manufacturer, F=distributor, G=researcher.
Technical Notes
DEA number structure: registrant type letter (A=hospital, B=pharmacy, C=practitioner, etc.) + registrant first letter of last name or 9 + 7 digits. Check digit: (d1+d3+d5) + 2*(d2+d4+d6), last digit of sum's rightmost digit = d7.
Have a pattern that belongs in the vault?
Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.
Submit a Pattern