REGEXVAULTv2.0
Security/Audit & Compliance
Verified Safe

NIST SP 800-53 Control Identifier Regex for Python

/^(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})\))?$/i

What this pattern does

This page provides a comprehensive, battle-tested regular expression for matching nist sp 800-53 control identifier, ported and verified for Python. 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 Python project — whether you're validating in a Django view, a FastAPI endpoint, or a standalone data processing script.

Python Implementation

Python
# NIST SP 800-53 Control Identifier
# ReDoS-safe | RegexVault — Security > Audit & Compliance

import re

nist_sp_80053_control_identifier_pattern = re.compile(r'^(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})\))?$')

def validate_nist_sp_80053_control_identifier(value: str) -> bool:
    return bool(nist_sp_80053_control_identifier_pattern.fullmatch(value))

# Example
print(validate_nist_sp_80053_control_identifier("AC-1"))  # True

Test Cases

Matches (Valid)
Rejects (Invalid)
AC-1XX-1
IA-5AC-100
SI-10 (3)AC-1-2
AC-2(1)AC 1
CM-6IA5

When to use this pattern

This pattern is drawn from the Security > Audit & Compliance category and carries a ReDoS-safe certification. That matters for Python developers because particularly important in Python web servers where CPU-bound regex operations can stall concurrent request handling. 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