NIST SP 800-53 Control Identifier Regex for PHP
/^(AC|AT|AU|CA|CM|CP|IA|IR|MA|MP|PE|PL|PM|PS|PT|RA|SA|SC|SI|SR)-([0-9]{1,2})(?:\s*\(([0-9]{1,2})\))?$/iWhat this pattern does
This page provides a comprehensive, battle-tested regular expression for matching nist sp 800-53 control identifier, ported and verified for PHP. In security-sensitive code, using an unverified regex can open the door to both false positives and denial-of-service attacks. 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
// NIST SP 800-53 Control Identifier
// ReDoS-safe | RegexVault — Security > Audit & Compliance
define('NIST_SP_80053_CONTROL_IDENTIFIER_PATTERN', '/^(AC|AT|AU|CA|CM|CP|IA|IR|MA|MP|PE|PL|PM|PS|PT|RA|SA|SC|SI|SR)-([0-9]{1,2})(?:\s*\(([0-9]{1,2})\))?$/');
function validate_nist_sp_80053_control_identifier(string $input): bool {
return (bool) preg_match(NIST_SP_80053_CONTROL_IDENTIFIER_PATTERN, $input);
}
// Example
var_dump(validate_nist_sp_80053_control_identifier("AC-1")); // bool(true)Test Cases
Matches (Valid) | Rejects (Invalid) |
|---|---|
AC-1 | XX-1 |
IA-5 | AC-100 |
SI-10 (3) | AC-1-2 |
AC-2(1) | AC 1 |
CM-6 | IA5 |
When to use this pattern
This pattern is drawn from the Security > Audit & Compliance 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
NIST SP 800-53 Rev. 4 vs Rev. 5 have different control sets. FedRAMP baseline (Low/Moderate/High) defines which controls apply to federal cloud systems. State whether you are referencing Rev. 4 or Rev. 5.
Technical Notes
NIST SP 800-53 Rev. 5 control families: AC=Access Control, AT=Awareness Training, AU=Audit Accountability, CA=Assessment Authorization, CM=Config Management, CP=Contingency Planning, IA=Identification Authentication, IR=Incident Response, MA=Maintenance, MP=Media Protection, PE=Physical Environmental, PL=Planning, PM=Program Management, PS=Personnel Security, PT=Privacy, RA=Risk Assessment, SA=System Services Acquisition, SC=System Communications, SI=System Information Integrity, SR=Supply Chain Risk.
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