REGEXVAULTv2.0
Security/Audit & Compliance
Verified Safe

PCI-DSS Requirement Reference Regex for Java

/^Req(?:uirement)?\s*([1-9]|1[0-2])(?:\.([1-9]|[1-9][0-9])(?:\.([1-9]|[1-9][0-9]))?)?$/i

What this pattern does

This page provides a comprehensive, battle-tested regular expression for matching pci-dss requirement reference, 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

Java
// PCI-DSS Requirement Reference
// ReDoS-safe | RegexVault — Security > Audit & Compliance

import java.util.regex.Pattern;

public class PcidssRequirementReferenceValidator {
    private static final Pattern PATTERN =
        Pattern.compile("^Req(?:uirement)?\\s*([1-9]|1[0-2])(?:\\.([1-9]|[1-9][0-9])(?:\\.([1-9]|[1-9][0-9]))?)?$");

    public static boolean validate(String input) {
        return PATTERN.matcher(input).matches();
    }

    // Example
    public static void main(String[] args) {
        System.out.println(validate("Requirement 3")); // true
    }
}

Test Cases

Matches (Valid)
Rejects (Invalid)
Requirement 3Req 13
Req 3.4Req 0
Requirement 10.2.1Requirement 3.4.5.6
Req 12PCI 3.4
Requirement 6.23.4.5

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

PCI-DSS v3.2.1 and v4.0 have different requirement numbering in some sections. The mandatory effective date for v4.0 is March 31, 2025 — after which v3.2.1 is retired.

Technical Notes

PCI-DSS v4.0 (released March 2022, mandatory from March 2025) has 12 requirements. Key requirements: 3 (Protect stored cardholder data), 4 (Encrypt transmission), 6 (Develop/maintain secure systems), 10 (Log and monitor), 12 (Information security policy). v4.0 adds 64 new requirements vs v3.2.1.

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