Regex Tester — Test JavaScript Regular Expressions Online

Test regular expressions with live match highlighting, capture groups and a replace preview. Free, no sign-up, and your files never leave your device.

Free, with no sign-up and no watermark. The file is processed in your browser and never uploaded.

Write a regular expression and see every match highlighted live in your test text, with a table of capture groups and an optional replace preview using $1,

lt;name> and
amp;
. Patterns run in a separate worker with a time limit, so a catastrophic pattern like (a+)+$ is stopped instead of freezing your browser.

Step by step

  1. Enter a pattern: Type it between the slashes; no need to escape the slashes themselves.
  2. Set flags: g global, i ignore case, m multiline, s dot-all, u unicode, y sticky.
  3. Add test text: Matches are highlighted and listed with their index and groups.
  4. Try a replacement: Tick Test a replacement and type the replacement string.

Handy for

Validation

Build and test patterns for emails, phone numbers or IDs.

Log parsing

Extract fields from log lines with groups.

Search and replace

Preview a replacement before running it in your editor.

Learning

Use the cheat sheet to experiment with syntax.

Good to know

  • This tests JavaScript regex syntax; PCRE, Python and Java differ in places (e.g. lookbehind support, possessive quantifiers).

  • Up to 5,000 matches are collected; the table shows the first 200.

Questions

Why does my pattern "stop after 1.5 s"?

It is backtracking exponentially. Nested quantifiers like (a+)+ or (.*)* are the usual cause — make them more specific.

Is my data sent anywhere?

No. Everything is processed by JavaScript in your browser tab — nothing you paste or open is uploaded, logged or stored on a server. You can even use the tool offline once the page has loaded.

More Developer Tools tools

  • Unix Timestamp Converter — Convert Unix timestamps in seconds or milliseconds to readable dates in any time zone, and back.
  • Binary, Hex & Decimal Converter — Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, of any size.
  • Color Converter — Convert colours between HEX, RGB, HSL, HSV, CMYK and CSS names, and check WCAG contrast.
  • Online Color Picker — Pick colours with a visual picker or grab them from anywhere on screen, and copy them in any format.
  • CSS Gradient Generator — Design linear, radial and conic gradients visually and copy the CSS.
  • Color Palette Generator — Generate colour palettes from harmony rules or at random, lock favourites, and export as CSS or JSON.

All Developer Tools tools