# Risky Regex Patterns

Collection of regex patterns that demonstrate security vulnerabilities, performance issues, and common anti-patterns to avoid

> Canonical page: https://elysiatools.com/en/samples/risky-regex

- **Category:** Validation

- **Keywords:** regex, security, performance, redo, catastrophic backtracking, vulnerability, pattern, validation

## Overview

Collection of regex patterns that demonstrate security vulnerabilities, performance issues, and common anti-patterns to avoid

## Examples

- **Catastrophic Backtracking Patterns**: Regex patterns that can cause exponential backtracking leading to Denial of Service (ReDoS)
- **Unanchored Validation Patterns**: Regex patterns without anchors that can match unintended positions in the input
- **Excessive Greedy Matching**: Greedy quantifiers that consume more than intended, causing incorrect matches
- **Inefficient Lazy Quantifiers**: Lazy quantifiers that are still inefficient or incorrect for the use case
- **Invalid Character Class Escapes**: Character classes with invalid ranges or unescaped special characters
- **Ambiguous Alternation Order**: Alternation patterns where order causes unexpected matches
- **Confusing Double Negation**: Patterns with double negation that are hard to read and error-prone
- **Redundant Escapes**: Unnecessary escape sequences that reduce readability
- **Octal and Backreference Ambiguity**: Patterns where \1 could mean octal or backreference
- **Excessive Capturing Groups**: Unnecessary capturing groups that impact performance

## When to use

- Use this sample set when you want reference inputs for Risky Regex Patterns.
- Use it to preview output formats and compare related sample variants.

## How it works

- Open a sample entry to inspect the prepared example payload or asset.
- Compare it with related tools to understand how the workflow connects.

## Use cases

- Catastrophic Backtracking Patterns
- Unanchored Validation Patterns
- Excessive Greedy Matching
- Inefficient Lazy Quantifiers
- Invalid Character Class Escapes
- Ambiguous Alternation Order

## Frequently asked questions

### What is included in Risky Regex Patterns?

This page includes curated sample entries, related tools, and neighboring sample collections for Risky Regex Patterns.

## Related tools

- [AI Regex Explainer](https://elysiatools.com/en/tools/ai-regex-explainer): Use AI to break down regular expressions into readable explanations
- [Glob to Regex](https://elysiatools.com/en/tools/glob-to-regex): Convert file matching patterns (Glob) to regular expressions
- [Regex Debugger](https://elysiatools.com/en/tools/regex-debugger): Step through how a regular expression matches a string position by position: visualize match attempts, partial successes, backtracks, and captures — a learning tool for understanding regex behavior, not just the final result
- [Regex Linter](https://elysiatools.com/en/tools/regex-linter): Detect error-prone and risky regex patterns, check for catastrophic backtracking, unanchored patterns, and provide rewrite suggestions
- [Regex Replace Previewer](https://elysiatools.com/en/tools/regex-replace-previewer): Preview regex replacements in real-time with detailed diff highlights and statistics
- [BGP Community Regex Tester and Looking-Glass Explainer](https://elysiatools.com/en/tools/bgp-community-string-regex-tester-and-looking-glass): Validate RFC 8294 BGP community regex patterns against a set of communities, match sample AS-paths, and generate Cisco/Juniper/FRR route-policy output.
- [Regex Railroad Diagram Visualizer](https://elysiatools.com/en/tools/regex-railroad-diagram-visualizer): Render a regular expression as an SVG railroad (syntax) diagram showing literals, groups, alternations, and repetition, with capture-group numbering and flag explanations
- [Regex Tester](https://elysiatools.com/en/tools/regex-tester): Test regular expressions against text

## Related content

- [Regex Pattern Alternatives](https://elysiatools.com/en/samples/regex-alternatives): Multiple ways to write the same regex pattern with different trade-offs in readability, performance, and accuracy
- [Common Regex Patterns](https://elysiatools.com/en/samples/regex-samples): Commonly used regular expression patterns for validation and matching
- [Regex Named Capture Groups](https://elysiatools.com/en/samples/regex-named-groups): Collection of regex patterns using named capture groups for extracting structured data from text. Named groups make patterns more readable and maintainable by assigning meaningful names to captured portions.
- [Regex Replace Samples](https://elysiatools.com/en/samples/regex-replace): Collection of common and useful regex replacement patterns for text transformation and data cleaning
- [Android String Processing Java Samples](https://elysiatools.com/en/samples/android-string-processing-java): Android Java string processing examples including string split and join, regular expressions, and string replacement
- [Android String Processing Kotlin Samples](https://elysiatools.com/en/samples/android-string-processing-kotlin): Android Kotlin string processing examples including string split and join, regular expressions, and string replacement
