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
#ValueIndexGroups
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.
TokenMeaningExample
JavaScript and PHP PCRE compatibility
FeatureJSPCRE
Named capture groupsYesYes
LookbehindModernYes
Atomic groupsNoYes
Possessive quantifiersNoYes
Recursion and subroutinesNoYes
Unicode property escapesYesYes
Extended free-spacing modeNox
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.
Regular Expression Toolkit