- Home
- Skills
- Testing & Debugging
- Regex Workbench
Works with the AI Agents you already use
Regex Workbench
Build, test, and audit regular expressions for ReDoS risks and cross-language portability.
$1
Regex Workbench
Example session with this skill installed
Check this regex for ReDoS risks and explain what it does: ^(a+)+$ Also show how to use it in Go.
- Read your context and instructions
- Compiled the regex workbench
I have analyzed the pattern ^(a+)+$ for performance risks and logic.
Regex Analysis: ^(a+)+$
| Feature | Details |
|---|---|
| Logic | Matches the start of the string, followed by one or more 'a' characters (repeated one or more times), ending at the string boundary. |
| ReDoS Risk | CRITICAL. This pattern contains nested quantifiers (a+)+. This causes exponential backtracking on strings like aaaaaab, which can hang the process. |
| Portability | UNSUPPORTED IN GO. Go's RE2 engine does not support patterns that could lead to exponential time complexity; however, it specifically lacks support for backreferences and certain lookarounds. While RE2 prevents the crash, the logic itself is flawed for general use. |
Logic Breakdown
^: Anchor to start of string.(a+)+: A group matching "a" one or more times, and that entire group is repeated one or more times. This creates overlapping paths for the engine.$: Anchor to end of string.
Implementation: Go (RE2)
package main
import (
"fmt"
"regexp"
)
func main() {
// Note: RE2 will handle this specific pattern safely but it is logically inefficient.
// Recommendation: Simplify to ^a+$
pattern := `^(a+)+$`
re := regexp.MustCompile(pattern)
text := "aaaaa"
if re.MatchString(text) {
fmt.Println("Match found")
}
}
Next steps
- Replace
^(a+)+$with^a+$to achieve the same result without the ReDoS vulnerability. - Run the
checkcommand on the simplified version to confirm linear time complexity. - Update your Go service with the simplified pattern.
Connects securely to your tools. The creator never sees your data.
About this skill
Writing regular expressions by hand is error-prone and notoriously difficult to debug. This skill provides a controlled environment to build, test, and audit patterns for performance and cross-language compatibility.
What it does
- Pattern testing runs regex against sample strings to extract matches, capture groups, and named groups.
- Token explanation breaks down complex patterns into plain English logic for easier auditing.
- Portability auditing flags syntax errors and behavior differences across Python, JavaScript, PCRE, Java, .NET, Go, and Rust.
- ReDoS detection identifies catastrophic backtracking risks like nested quantifiers before they hit production.
- Code generation outputs ready-to-paste implementation blocks for multiple programming languages.
How it works
- Use the
testcommand to verify a pattern against specific text or files. - Run the
explaincommand to get a token-by-token breakdown of how the engine interprets the string. - Invoke
checkto perform ReDoS heuristic analysis and portability checks for different runtimes. - Execute
codeto generate the final implementation snippets with appropriate flags.
Frameworks & tools
The core engine utilizes Python re for execution. It provides compatibility mapping for JavaScript (V8), PCRE/PHP, Java, .NET, Go (RE2), and Rust.
Why this beats prompting it yourself
Generic LLM prompts often ignore engine-specific quirks like Go's lack of lookaheads or Python's Unicode handling for \d. This skill enforces a systematic check for catastrophic backtracking and cross-language syntax errors that simple chat interactions miss.
Use cases
- Debugging complex email or URL validation patterns with named capture groups.
- Porting a PCRE pattern from a legacy PHP app to a Go microservice.
- Hardening user-input regex against ReDoS attacks in high-traffic APIs.
- Generating boilerplate code for regex implementation in new projects.
Known limitations
Testing is performed using Python's regex engine. Portability flags are advisory and based on known syntax differences rather than live execution in all target environments.
Testing executes via Python re. Portability checks for Go and Rust are syntax-based. Performance metrics reflect the local environment's CPU.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 month ago
Requires