Pattern
Build a regular expression
/
/
Developer utility
Test JavaScript regular expressions with live matches, capture groups, named groups, flags, highlighted text, and replacement output directly in your browser.
Pattern
Waiting for input.
Match list
| # | Match | Index | Length | Groups |
|---|
Capture groups
| Match | Group | Value |
|---|
Preview
Replace
Examples
| Token | Meaning | Example |
|---|---|---|
. | Any character except newline unless dotAll is enabled. | a.c |
\d | Digit character. | \d{4} |
\w | Word character: letters, digits, underscore. | \w+ |
+ | One or more of the previous token. | \w+ |
* | Zero or more of the previous token. | .* |
? | Optional token or lazy quantifier marker. | https? |
() | Capture group. | (\d{4})-(\d{2}) |
(?<name>...) | Named capture group. | (?<year>\d{4}) |
^ / $ | Start and end anchors. | ^Title |
\b | Word boundary. | \bcat\b |
(?<year>\d{4}) when replacement output needs readable placeholders..* can match empty text. The tester guards zero-length matches to keep the page responsive.Yes. It uses the native JavaScript RegExp implementation in your browser.
Yes. JavaScript replacement syntax such as $1, $2, and $<name> works in the replacement field.
JavaScript regex does not support every PCRE feature. Browser support also depends on the user's current JavaScript engine.