NIST SP 800-53 Control Identifier Regex for Java
/^(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 Java. 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 Java project — whether you're validating in a Spring Boot controller, a Jakarta EE service, or a standalone utility class.
Java Implementation
// NIST SP 800-53 Control Identifier
// ReDoS-safe | RegexVault — Security > Audit & Compliance
import java.util.regex.Pattern;
public class NistSp80053ControlIdentifierValidator {
private static final Pattern PATTERN =
Pattern.compile("^(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})\\))?$");
public static boolean validate(String input) {
return PATTERN.matcher(input).matches();
}
// Example
public static void main(String[] args) {
System.out.println(validate("AC-1")); // 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 Java developers because critical in Java applications since the JVM regex engine uses backtracking and is susceptible to ReDoS without careful pattern design. 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