Regex Tester
Type your regex pattern and test string to see live matches, groups, and indices instantly.
How to use Regex Tester
The Regex Quick Reference provides an interactive cheat sheet for regular expression syntax across the most common flavours: JavaScript (ECMAScript), Python (re module), PCRE (PHP, Ruby, Perl) and POSIX ERE (grep, sed). Look up metacharacters, quantifiers, anchors, character classes and assertions with live examples — an essential companion for developers building search, validation and text-processing logic.
- Browse the categorised reference tables for metacharacters, quantifiers, character classes and assertions.
- Click any pattern in the table to load it into the live tester with a sample string.
- Edit the pattern and test string to explore variations in real time.
- Use the flavour selector to switch between JavaScript, Python re, PCRE and POSIX ERE syntax.
- Copy a pattern directly from the table for use in your code.
Your data never leaves your device — 100% private processing.
Regex flavour differences that trip developers up
While most regex flavours share the same core syntax, there are important differences. JavaScript does not support lookbehind assertions in older engines (added in ES2018 for modern browsers). Python re uses (?P<name>...) for named groups while JavaScript uses (?<name>...). POSIX ERE does not support lookahead or lookbehind at all. Perl-style character class shortcuts (\d, \w, \s) are universal, but their exact Unicode handling varies: in Python, \d matches any Unicode digit unless the re.ASCII flag is set.
| Feature | JavaScript (ES2018+) | Python re | PCRE | POSIX ERE |
|---|---|---|---|---|
| Named groups | (?<name>...) | (?P<name>...) | (?P<name>...) | Not supported |
| Lookbehind | (?<=...) | (?<=...) | (?<=...) | Not supported |
| Unicode property | \p{L} (u flag) | Not built-in | \p{L} | Not supported |
| Atomic groups | Not supported | Not supported | (?>...) | Not supported |
| Possessive quantifiers | Not supported | Not supported | a++ | Not supported |
Writing efficient and maintainable regex patterns
Poorly written regular expressions can suffer from catastrophic backtracking — a condition where the engine explores exponentially many paths in the match tree, causing a 50-character input to take seconds or minutes to process. Avoid nested quantifiers like (a+)+ on input that can match many ways. Use possessive quantifiers or atomic groups (where supported) to prevent backtracking in known-safe regions. For readability, use verbose mode (Python re.VERBOSE or PCRE's x flag) to add comments and whitespace within the pattern, making complex expressions self-documenting.
Glossary
- Metacharacter
- A character with special meaning in regex syntax, such as . * + ? [ ] ( ) { } ^ $ | \.
- Anchor
- A zero-width assertion that matches a position rather than a character, such as ^ (start) or $ (end).
- Backtracking
- The process by which the regex engine retries alternative match paths when the current path fails.
- Greedy quantifier
- A quantifier (*, +, ?) that matches as many characters as possible while still allowing the overall match to succeed.
- Lazy quantifier
- A quantifier followed by ? (*?, +?, ??) that matches as few characters as possible.
Related reading
Frequently Asked Questions
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Why use Regex Tester?
- No installation — use directly from any browser
- Handles large inputs without crashing or timeouts
- Syntax highlighting and formatted output for readability
- Copy to clipboard shortcut for fast workflow integration
Common use cases
- Validate and format JSON responses from APIs
- Encode/decode Base64 strings during debugging
- Generate UUIDs for database seeds or test data
- Minify CSS or JavaScript before deployment
- Diff two code snippets to spot regressions
Related Developer Tools
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
URL Encoder / Decoder
Encode and decode URLs and URL components online. Convert special characters to percent-encoding and back instantly — free, private, and fast.
Regex Tester
Test and debug regular expressions online. See live matches, capture groups, and replace output. Free, private, instant.
Base64 Encoder & Decoder
Encode text or files to Base64, or decode Base64 strings back to text. Fast, free, and runs entirely in your browser.
HTML Encoder / Decoder
Encode and decode HTML entities online. Escape <, >, &, and quote characters for safe HTML display. Free, instant, and private — runs in your browser.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes online. Hash text or files privately in your browser.
Explore all Developer Tools.