How do I test a regular expression online?
Enter your regex pattern and test string, and see all matches highlighted in real time. The tool supports JavaScript regex flags (g, i, m, s, u), shows capture groups, and explains what each part of your pattern does. Everything runs client-side in your browser.
Pattern: [\w.-]+@[\w.-]+\.\w+ Text: Contact us at hello@devbolt.dev or support@example.com
Match 1: hello@devbolt.dev Match 2: support@example.com
Regex Tester
Test regular expressions in real time with match highlighting and capture groups.
Matches (0)
Enter a pattern and test string to see matches
Tips & Best Practices
Catastrophic backtracking can freeze your app
Patterns like (a+)+ or (a|a)* cause exponential backtracking on non-matching input. A 25-character string can take minutes to process. Use atomic groups or possessive quantifiers (a++ in Java/PCRE) to prevent this. In JavaScript, use the 'v' flag with set notation where possible.
Test edge cases, not just happy paths
An email regex that matches test@example.com might also match test@.com or @example.com. Always test with: empty strings, strings with only whitespace, extremely long input (>1000 chars), Unicode characters, and inputs that almost-but-don't-quite match your pattern.
Named capture groups make regex maintainable
Instead of (\d{4})-(\d{2})-(\d{2}) where you access groups by index, use (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}). In JavaScript: match.groups.year. Named groups act as documentation and survive refactoring when you add or remove groups.
Never use regex for HTML parsing
Regular expressions cannot handle nested structures. A regex to extract href attributes will break on nested quotes, CDATA sections, comments containing tags, and self-closing elements. Use a proper HTML parser (DOMParser in browsers, cheerio/jsdom in Node.js).
Frequently Asked Questions
How do I test a regular expression online?
What does the g flag do in regex?
How do I match an email address with regex?
Related Inspect Tools
TypeScript 6.0 Migration Checker
Analyze your tsconfig.json for TS 6.0 breaking changes, deprecated options, new defaults, and get a readiness grade with fixes
AI Code Security Scanner
Scan JavaScript and TypeScript code for vulnerabilities — hardcoded secrets, injection, XSS, SSRF, prototype pollution, and 20+ security checks
Code Complexity Analyzer
Analyze JavaScript and TypeScript code for cyclomatic complexity, cognitive complexity, nesting depth, and maintainability index with per-function metrics
GitHub Actions Validator
Validate GitHub Actions workflow YAML files for syntax, triggers, job structure, step config, needs dependencies, and deprecated actions