Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Regex Workbench

    1

    Build, test, and audit regular expressions for ReDoS risks and cross-language portability.

    $9.99

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned
    Regex Workbench

    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+)+$

    FeatureDetails
    LogicMatches the start of the string, followed by one or more 'a' characters (repeated one or more times), ending at the string boundary.
    ReDoS RiskCRITICAL. This pattern contains nested quantifiers (a+)+. This causes exponential backtracking on strings like aaaaaab, which can hang the process.
    PortabilityUNSUPPORTED 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

    1. Replace ^(a+)+$ with ^a+$ to achieve the same result without the ReDoS vulnerability.
    2. Run the check command on the simplified version to confirm linear time complexity.
    3. 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

    1. Use the test command to verify a pattern against specific text or files.
    2. Run the explain command to get a token-by-token breakdown of how the engine interprets the string.
    3. Invoke check to perform ReDoS heuristic analysis and portability checks for different runtimes.
    4. Execute code to 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.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 1 day ago

    • Passed all security checks, Safe to install

    Listed1 day ago

    What's inside

    Frequently Asked Questions