Examples
Find email-like strings globally
Pattern: \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b
Flags: g
Text: Write to dev@example.com or ops.team+alerts@sub.example.org; ignore user@.com.[
{
"match": "dev@example.com",
"index": 9
},
{
"match": "ops.team+alerts@sub.example.org",
"index": 28
}
]The global flag returns both complete matches; the malformed user@.com substring does not satisfy the domain portion.
Inspect numbered and named capture groups
Pattern: (?<year>\d{4})-(\d{2})-(\d{2})
Flags: g
Text: Releases: 2026-01-15 and 2026-07-01.[
{
"match": "2026-01-15",
"index": 10,
"captures": ["2026", "01", "15"],
"groups": { "year": "2026" }
},
{
"match": "2026-07-01",
"index": 25,
"captures": ["2026", "07", "01"],
"groups": { "year": "2026" }
}
]The year is available as both capture 1 and the named year group; month and day are captures 2 and 3.
Compare single, global, and case-insensitive matching
Pattern: error
Text: Error: one
error: two
error: three
ERROR: fourno flags: ["error"]
g: ["error", "error"]
gi: ["Error", "error", "error", "ERROR"]Without g, JavaScript stops after the first case-sensitive match; g finds every case-sensitive match, and i adds case-insensitive matching.
About this tool
A regular expression is a compact language for describing text patterns — used everywhere from form validation and log parsing to search-and-replace and data extraction. This tester lets you build a pattern and see exactly what it matches, character by character, as you type. Matches are highlighted directly inside your test string and broken down into capture groups, named groups, and positions.
The engine is the browser's native JavaScript (ECMAScript) RegExp, so results are identical to what your JavaScript or Node.js code will do at runtime — no surprises between the tester and production. Matching runs in a Web Worker with a timeout, so even a pathological pattern that would normally freeze the tab is stopped safely and reported as a likely catastrophic-backtracking case.
Everything is client-side: your pattern and test data never leave the browser. Switch to Substitution mode to preview find-and-replace with $1 / $<name> references, load a sample to learn a new construct, or copy the shareable link to send a working pattern to a teammate — the pattern, flags, and test text are all encoded in the URL.
How to use
Write a pattern and see live matches
Type a regular expression in the editor; it is syntax-highlighted as you go. Every match is highlighted in the Test String preview and listed with its offsets in the Match Information panel below.
Toggle flags
Click the g, i, m, s, u, and y buttons to switch flags on and off. Global (g) finds all matches; insensitive (i) ignores case; multiline (m) changes ^ and $; dotAll (s) lets . match newlines.
Inspect capture groups
Hover a match to link it to its entry in the Match Information panel, which shows each numbered and named capture group with its value and position.
Replace with substitution
Open the Substitution tab and enter a replacement using $1, $<name>, or $& to reference matches. The replaced output previews live and can be copied.
Share a pattern
Click 'Copy link' to copy a URL that encodes the pattern, flags, and test text so anyone can open the exact same setup.
Use cases
Validating input formats
Prototype JavaScript patterns for identifiers, dates, email-like strings, or version numbers before moving the pattern into client or server validation code.
Extracting structured data from logs
Use numbered or named groups to pull timestamps, status codes, request IDs, and paths from representative log lines and inspect every match offset.
Designing search-and-replace rules
Preview substitutions with $1, $<name>, or $& before applying a bulk refactor or cleanup to source files and datasets.
Reproducing a regex bug
Share the encoded pattern, flags, and test text with a teammate so both people debug the same JavaScript RegExp behavior.
Common regex tokens
| Token | Matches |
|---|---|
| \d \w \s | A digit, a word character, or whitespace |
| . | Any character (any except newline unless the s flag is set) |
| * + ? | Zero-or-more, one-or-more, or optional (zero-or-one) |
| {n} {n,} {n,m} | Exactly n, at least n, or between n and m repetitions |
| ^ $ \b | Start of input/line, end of input/line, a word boundary |
| [abc] [^abc] | Any one listed character / any character not listed |
| (…) (?:…) (?<name>…) | Capturing, non-capturing, and named groups |
| (?=…) (?!…) | Positive and negative lookahead |
| a|b | Alternation — match a or b |
Uses the JavaScript (ECMAScript) regex flavor — the same engine your browser and Node.js run.
Common mistakes
Mistake:Forgetting that ., *, (, ), and other metacharacters have special meanings.
Fix:Escape syntax characters when they must be literal, such as \. for a dot and \( for an opening parenthesis. When building a RegExp from a JavaScript string, remember the string layer may require an additional backslash.
Mistake:Using greedy .* for a bounded field or omitting anchors when the whole input must match.
Fix:Prefer a specific character class or a lazy quantifier where appropriate, and add ^ and $ when partial substring matches should be rejected.
Mistake:Testing catastrophic-backtracking patterns only on short successful input.
Fix:Test long near-misses as well as matches, avoid ambiguous nested quantifiers, and simplify overlapping alternatives. The tester's timeout is a warning, not proof that a pattern is safe at production scale.
Mistake:Expecting repeated exec-style matching without the g flag, or expecting g to make matching case-insensitive.
Fix:Use g to iterate through all matches and i independently for case-insensitive matching. Treat flags as separate behavior switches.
Frequently asked questions
Related guides
Find and Replace with Regular Expressions: A Practical Guide
How capture groups, alternation, and lazy vs. greedy matching turn search-and-replace from tedious editing into precise transformation.
Best Free Developer Tools in 2026: An Honest Comparison
The best free, browser-based developer tools compared — CyberChef, Regex101, JWT.io, and the privacy-first alternatives. What to use for JSON, regex, JWTs, hashing, UUIDs, and more.
How to Read a Regular Expression (Even a Scary One)
A token-by-token method for decoding any regex — anchors, classes, groups, lookarounds and quantifiers — so patterns stop looking like line noise.
References & standards
Related tools
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
CSV to Chart
Paste or upload CSV data and generate bar, line, pie, or doughnut charts. Export as PNG.
CSV to JSON Converter
Paste CSV data and convert it to pretty-printed JSON instantly — supports custom delimiters, header row toggling, and value trimming.
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV
CSV to SQL Converter
Generate SQL INSERT statements from CSV data
cURL to Code Converter
Convert cURL commands to code snippets in multiple languages. Parse cURL and generate JavaScript, Python, PHP, and more.