Regex Tester
Test regular expressions live with the Rust regex engine (WebAssembly): match highlighting, capture and named groups, i/m/s flags and saved patterns.
Your inputs and files stay in your browser
Common Tokens
.- Any char
\d- Digit
\w- Word char
\s- Whitespace
^- Start
$- End
*- 0 or more
+- 1 or more
?- 0 or 1
Type or paste text to test the pattern against, or load an example.
Matches
Enter a pattern — matches with their positions and capture groups appear here.
Saved Patterns
No saved patterns yet.
| Name | Pattern | Actions |
|---|
Examples
| Name | Pattern | Actions |
|---|
On this page
Write a regular expression and see every match highlighted in your test text as you type, with positions and capture groups listed below. Patterns run on the Rust regex crate compiled to WebAssembly, so syntax and behavior are those of Rust, not of JavaScript.
Detailed Functionality
Supported syntax includes character classes and Unicode classes such as \p{Cyrillic}, greedy and lazy quantifiers, alternation, anchors, word boundaries \b, numbered groups, named groups (?<name>…) or (?P<name>…), non-capturing groups and inline flags such as (?i). Look-ahead, look-behind and backreferences like \1 are not supported by this engine — the tool shows the engine's error instead. In exchange, matching time grows linearly with the input, so patterns like (a+)+$ cannot hang the page.
Flags: i ignores case, m makes ^ and $ match at every line, s lets . match a newline; with Global off only the first match is shown. Unicode mode is always on in the Rust engine, so \w, \d and . match non-ASCII letters, digits and characters. Positions are JavaScript string indices (UTF-16, an emoji takes 2). The list shows the first 50 matches, and counting stops at 10,000.
Everything runs locally. A pattern is stored — with its name, flags and sample text, in this browser's localStorage — only when you press Save Pattern. Five built-in examples (email, IPv4 address, date, hex color, URL) load with one click.
Practical Examples
Named groups: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) on Released 2026-10-06, patched 2026-11-02 gives 2 matches; the first is 2026-10-06 at [9-19] with year 2026, month 10, day 06.
Case-insensitive alternation: error|warn with the i flag on the lines ERROR: disk full and Warn: low memory matches ERROR and Warn.
Line anchors: ^\w+ on the lines alpha one and beta two matches only alpha; with the m flag it matches alpha and beta.
Unsupported look-ahead: foo(?=bar) is rejected with “look-around, including look-ahead and look-behind, is not supported” — match foo(bar) and use the group instead.
How to Use This Tool
Enter a pattern
Type the expression into Pattern without surrounding slashes. Cheat Sheet lists the most common tokens.
Set the flags
Under Flags, tick Insensitive, Multi-line or Dot all as needed; untick Global to see only the first match.
Add test text
Paste text into Test String — matches are highlighted as you type.
Inspect the matches
The Matches list shows each match with its
[start-end]position and capture groups.Save or reuse
Press Save Pattern to keep the expression, then Load it from Saved Patterns or start from one of the Examples.
Tips and Best Practices
- JavaScript or PCRE patterns that use look-around or
\1must be rewritten: capture the surrounding text in a group, or check the condition in code. /needs no escaping, but a literal dot does: write\.for “.”.- Inline flags work inside the pattern too:
(?i)erroris the same aserrorwith the i flag. - Saved patterns live only in this browser; clearing site data deletes them.
- Use
\baround words (\bcolou?r\b) socoloursis not matched ascolour.