Regex Tester & Replacer
Test JavaScript regular expressions against any string with live match highlighting, capture groups (named and numbered), and optional replace.
Contact ada@example.com or grace@nasa.gov to volunteer. Alan.turing@bletchley.uk maintains the crypto machines.
- #1 @ 8: ada@example.comGroups: $1=ada$2=example.com
- #2 @ 27: grace@nasa.govGroups: $1=grace$2=nasa.gov
- #3 @ 61: turing@bletchley.ukGroups: $1=turing$2=bletchley.uk
How to use
- 1Write your pattern
JavaScript regex syntax. No leading /…/ delimiters — just the pattern.
- 2Pick flags
i = case-insensitive · m = multiline · s = dotAll · u = unicode. The g (global) flag is always on so all matches show.
- 3Paste text to test against
Every match highlights live, with named and numbered capture groups shown below.
- 4Try a replacement
Optional replacement box supports $1 $2 backrefs and $<name> for named groups.
Examples
Pattern: [\w.+-]+@[\w-]+\.[\w.-]+ Text: contact alex@example.com or team@toolvaults.net
Matches: alex@example.com · team@toolvaults.net
Pattern: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
Text: 2026-08-14Match: 2026-08-14 Groups: year=2026, month=08, day=14
Pattern: (\w+)\s(\w+) Text: Hello World Replace: $2 $1
World Hello
Frequently asked
JavaScript / ECMAScript regex (via the browser's native RegExp). Very close to Perl-compatible (PCRE) but with a few differences around lookbehinds, unicode, and named groups.
Without global mode you'd only ever see one match. The tool forces "g" so all matches are shown; other flags are yours to toggle.
The "y" flag forces the match to start exactly at lastIndex. Rarely useful interactively — mainly for building high-performance tokenizers.
Related tools
- JSON FormatterFormat, validate, and minify JSON in your browser. See parse errors with line/co
- SQL FormatterFormat and beautify SQL for 10 dialects including PostgreSQL, MySQL, SQLite, Big
- Text DiffCompare two blocks of text line by line and see exactly what changed. Runs entir
- .env File ParserParse a .env file and see it as a JSON object. Handles comments, quoted values,
- Base ConverterConvert numbers between binary, octal, decimal, and hexadecimal. Supports huge n
- Credit Card ValidatorValidate credit card numbers with the Luhn algorithm and detect the brand: Visa,