US DEA Number (Drug Enforcement Administration) Regex for PHP
/^[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 PHP. 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 PHP project — whether you're validating in a Laravel validator, a WordPress plugin, or a standalone PHP script.
Php Implementation
<?php
// US DEA Number (Drug Enforcement Administration)
// ReDoS-safe | RegexVault — Identity & PII > Health Identifiers
define('US_DEA_NUMBER_DRUG_ENFORCEMENT_ADMINISTRATION_PATTERN', '/^[ABCDEFGHJKLMNPQRSTUX][A-Z9][0-9]{7}$/');
function validate_us_dea_number_drug_enforcement_administration(string $input): bool {
return (bool) preg_match(US_DEA_NUMBER_DRUG_ENFORCEMENT_ADMINISTRATION_PATTERN, $input);
}
// Example
var_dump(validate_us_dea_number_drug_enforcement_administration("AB1234563")); // bool(true)Test 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 PHP developers because especially relevant in PHP where PCRE backtracking limits can trigger silent failures on malicious input. 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