Regular Expression Workbench
Use JavaScript locally for instant testing or switch to PHP PCRE for server-side compatibility.
Local JavaScript engine
Regular expression
Enter only the pattern body. Do not include slash delimiters.
JavaScript runs locally. PHP PCRE uses AJAX.
/
/
JavaScript flags: d g i m s u v y. Global matching requires g.
Text used for matching, extraction, replacement or splitting.
JavaScript supports $&, $1 and $<name>. PCRE supports $0, $1 and related replacement syntax.
Results
Ready
Matches0
Groups0
Time0 ms
Match preview
Match details and groups
| # | Value | Index | Groups |
|---|
Pattern explanation
Enter a pattern to see a structural explanation.
Operation output
Replacement and split results will appear here.
Visual pattern generator
Build common validation patterns without memorizing every token.
Choose the main characters allowed in the generated expression.
Enter the inside of a character class, without square brackets.
Adds a positive lookahead requiring this exact text somewhere in the value.
Generated expression
The generator targets broadly compatible syntax. Always test against your target engine and real data.
Common pattern library
Reusable patterns for common validation and extraction tasks.
No matching patterns.
Regex syntax quick reference
Search tokens, meanings and examples.
| Token | Meaning | Example |
|---|
JavaScript and PHP PCRE compatibility
| Feature | JS | PCRE |
|---|---|---|
| Named capture groups | Yes | Yes |
| Lookbehind | Modern | Yes |
| Atomic groups | No | Yes |
| Possessive quantifiers | No | Yes |
| Recursion and subroutines | No | Yes |
| Unicode property escapes | Yes | Yes |
| Extended free-spacing mode | No | x |
Performance and safety
- Avoid nested ambiguous quantifiers such as (a+)+ on untrusted long input.
- Use anchors and specific character classes when validating complete values.
- PHP mode applies input size and PCRE resource limits to reduce accidental overload.
- Benchmark important production patterns with representative data.