REGEXVAULTv2.0
Security/Audit & Compliance
Verified Safe

OWASP Top 10 Reference Regex for JavaScript

/^A(?:0[1-9]|10):2021$/i

What this pattern does

This page provides a lightweight, single-purpose regular expression for matching owasp top 10 reference, ported and verified for JavaScript. 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 JavaScript project — whether you're validating in an Express middleware, a Next.js API route, or a client-side form.

Javascript Implementation

Javascript
// OWASP Top 10 Reference
// ReDoS-safe | RegexVault — Security > Audit & Compliance

const owaspTop10ReferenceRegex = /^A(?:0[1-9]|10):2021$/i;

function validateOwaspTop10Reference(input: string): boolean {
  return owaspTop10ReferenceRegex.test(input);
}

// Example
console.log(validateOwaspTop10Reference("A01:2021")); // true

Test Cases

Matches (Valid)
Rejects (Invalid)
A01:2021A00:2021
A03:2021A11:2021
A10:2021A01:2023
A1:2021
A01-2021

When to use this pattern

This pattern is drawn from the Security > Audit & Compliance category and carries a ReDoS-safe certification. That matters for JavaScript developers because especially critical in long-running Node.js event loops where a ReDoS vulnerability can block the entire process. 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

OWASP Top 10 editions (2013, 2017, 2021) have different category numbering and content. Specify the year edition when referencing. The 2021 list elevated A04 Insecure Design as a new category.

Technical Notes

OWASP Top 10 2021: A01=Broken Access Control, A02=Cryptographic Failures, A03=Injection, A04=Insecure Design, A05=Security Misconfiguration, A06=Vulnerable/Outdated Components, A07=Identification/Authentication Failures, A08=Software/Data Integrity Failures, A09=Security Logging/Monitoring Failures, A10=Server-Side Request Forgery.

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