Skip to content
World Cup Kickoff Time Converter is liveSee kickoff times in your time zone and add calendar reminders.

Regex Tester

Test JavaScript regular expressions locally with g/i/m/s/u/y flags, match counts, line-column ranges, capture groups, named groups, and native replace preview.

1A

Test Text

2

Pattern

/

/g

0 matches0 capture groups0 named groups
3

Match Results

Enter a pattern to start matching

4

Replace

B

Replacement

Replacement Preview

Regex Tester

Quick Start

1
Enter a regex pattern, choose flags (g/i/m/s/u/y), and paste test text.
2
Review matches, line ranges, capture groups, and named groups.
3
Enter a replacement template ($1, $2, $<name>) to preview String.replace output.
4
Copy the pattern or replacement result; Clear empties the workbench.

Common Scenarios

Data extraction

use (\\d{4}-\\d{2}-\\d{2}) to extract dates, and ([\\w.]+@[\\w.]+) to extract email addresses

Format validation

write a regex, paste multiple samples, and quickly verify whether the pattern precisely matches the target format

Batch replacement

use capture groups to restructure content. For example, convert "First Last" to "Last, First" with pattern (\\S+)\\s+(\\S+) and replacement $2, $1

Named groups

use (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) to extract dates, then use $<year>/$<month>/$<day> to rebuild them

Regex learning

try different patterns and observe matching behavior to understand quantifiers, anchors, and character classes visually

Multi-line handling

enable the m flag so ^ and $ match by line, useful for logs, code, and configuration files

Usage Advice

Global search (g) is enabled by default; turn it off only when you need the first match
In this tool, enter \\d, \\w, and \\s directly; no double escaping is needed like in code strings
m makes ^ and $ match by line, while s lets . match newline characters; they solve different problems and can be combined when needed
Prefer specific patterns over broad .* patterns to avoid unexpected matches.
Always verify replacement output before applying it elsewhere.
The tool includes performance-risk detection and warns about patterns that may cause catastrophic backtracking, such as nested quantifiers

Limitations & Compatibility

This tool uses your browser's JavaScript RegExp engine. It does not switch to PCRE, Python, Java, Go, recursive patterns, conditional branches, or atomic groups.
Lookbehind assertions (?<=...) require Chrome 62+ / Firefox 78+ / Safari 16.4+; JavaScript usually requires fixed length, so avoid variable quantifiers like * or + inside the assertion
Large text with complex patterns can trigger catastrophic backtracking. CrateX.app uses a worker, risk warning, safety mode, and timeout protection, but it is not a ReDoS proof.

Privacy & Security

Processing runs in your browser. The regex pattern, test text, replacement template, flags, line-number, and wrapping choices may stay in the current browser session or browser storage. If you save a workspace or enable WebDAV sync, those values may be saved according to your sync settings. Match details and replacement preview are derived from the current inputs and are not stored as separate results. On shared devices, clear the fields and site data when needed.

FAQ

6

Continue with these related tools for the next step.

All tool processing happens locally in your browser.