Back to Developers
Developersregexparsingsecurity
Optimized Regular Expression Engine
Builds highly performant, secure regular expressions for complex string matching while avoiding catastrophic backtracking.
Use Case
Use this prompt to write complex string validation routines, input checkers, or log parsing logic quickly and securely.
AI Prompt
Act as a senior software engineer. Create a highly optimized, clean regular expression to match the following pattern requirements: [insert matching criteria, target text formats, and forbidden characters here]. Include a list of test cases that must match successfully, and test cases that must fail. Explain each component of the regular expression token-by-token, and ensure it is safe from catastrophic backtracking issues (ReDoS).
How to Use
- 1State what you want to extract, match, or validate.
- 2Specify any special rules or string constraints.
- 3Review the explanation to understand exactly how the regex functions before deploying it.
Example Output
The regular expression to match secure passwords requires at least one uppercase letter, one digit, and one special character, with a length between eight and sixty-four characters. It uses positive lookaheads to assert these conditions without consuming characters, preventing security-related search backtracking issues.
Related Prompts
View AllVulnerability and Security Code Auditor
Scans code for common security vulnerabilities (e.g. OWASP Top 10) and provides detailed mitigation instructions.
securityowaspcode-audit
View Prompt
Zero-Dependency Regular Expression Engineer
Generates safe, high-performance, and secure regular expressions accompanied by exhaustive test cases.
regexpattern-matchingsecurity
View Prompt
Security Vulnerability (SAST) Code Auditor
Scans source code for security vulnerabilities, OWASP Top 10 exploits, and insecure dependencies.
securityowaspvulnerability
View Prompt