Regex Tester Online

Test regular expressions live with matches, groups, and flags in your browser. Your patterns and text stay local.

Your pattern and test string are evaluated locally in your browser and nothing is uploaded to a server.

Built and maintained by Udit Agarwal

Regular Expressions (Regex), Explained

Comparing two strings instead? Try the Text Diff tool.

About Regex Tester

This regex tester lets you build and debug JavaScript regular expressions live, with every match highlighted in your sample text the moment you type. As an online regex tester it shows capture groups, named groups and the start index of each match, so you can see precisely what a pattern catches. Toggle the i, m, s and u flags to test regular expressions under different conditions without rewriting them; matching is always global, so every match is listed. It uses the same RegExp engine your browser ships with, so results match what your JavaScript code will actually do at runtime. Useful for developers writing validation, QA engineers checking parsing rules, and anyone learning regexp. Everything runs locally in your browser, so your patterns and test data never leave your device.

Features

  • Highlights every match in your test string live as you type the pattern
  • Shows numbered capture groups and named groups for each match
  • Reports the start index of every match, numbered in order
  • Toggle the i, m, s and u flags individually; matching is always global
  • Uses the native browser JavaScript RegExp engine for accurate results
  • Surfaces pattern syntax errors so you can fix invalid expressions fast
  • Processes patterns and test text entirely in your browser

How to use the Regex Tester

  1. Type or paste your regular expression into the pattern field.
  2. Toggle the flags you need (i, m, s, u) next to the pattern.
  3. Paste your sample text into the test string box.
  4. Read the highlighted matches, capture groups and positions in the results panel.

Example

Input

Pattern: (\w+)@(\w+)\.com  Flags: g
Text: contact alice@example.com or bob@test.com

Output

Match 1: alice@example.com  group1=alice  group2=example
Match 2: bob@test.com  group1=bob  group2=test

Two matches with capture groups extracted from each email.

Common errors & troubleshooting

  • Turning the g flag off still lists every match. — The tester always searches globally so you can see every match. In your own code a regex without g stops at the first match with exec() or match(), so add g there when you need them all.
  • Case-sensitive pattern misses words like 'Error' vs 'error'. — Turn on the i (ignore case) flag so the pattern matches regardless of letter case.
  • A dot (.) is not matching newline characters in multiline text. — Enable the s (dotall) flag so . also matches line breaks.
  • ^ and $ only anchor to the whole string, not each line. — Enable the m (multiline) flag to anchor at the start and end of every line.
  • Named groups or Unicode property escapes (\p{...}) throw an error. — Enable the u (unicode) flag, which is required for \p{...} escapes and strict Unicode handling.
  • The pattern field shows a syntax error. — Check for unbalanced brackets or parentheses and escape literal special characters like . or ( with a backslash.

Frequently asked questions

What is a regex tester?
A regex tester runs a regular expression against sample text and shows you what it matches in real time. ArrayKit's Regex Tester highlights every match, lists capture groups and reports each match position so you can debug patterns visually.
Which regex flavour does the Regex Tester use?
JavaScript — it uses the same RegExp engine your browser runs, so matches reflect exactly how your JS code will behave.
How do I test capture groups in the Regex Tester?
Wrap parts of your pattern in parentheses and run it against your text. Each match lists its numbered capture groups and any named groups, along with the index where the match starts.
Which flags can I toggle in the Regex Tester?
You can switch i (ignore case), m (multiline), s (dotall) and u (unicode) on or off independently to test regular expressions under different conditions. There is a g (global) button too, but matching is always global, so every match is listed either way.
Can the Regex Tester handle multiline text?
Yes. Paste multiline input and enable the m flag to anchor ^ and $ per line, or the s flag so . spans line breaks.
Are my patterns and test data sent anywhere?
No. The Regex Tester evaluates everything locally in your browser, so your patterns and sample text never leave your device and nothing is uploaded to a server.

Related tools

Guides

More Code Formatters tools

  • CSS Color Converter — Convert between HEX, RGB and HSL with a live swatch.
  • Text Diff — Compare two texts line-by-line and see additions and removals.
  • MDX Converter — Render MDX as formatted text, convert HTML → MDX, and escape text to literal MDX.
  • CSS / SCSS Formatter — Beautify or minify CSS/SCSS/LESS, sort properties and remove duplicates.
  • JS / TS Formatter — Beautify JavaScript, TypeScript and JSX/TSX with Prettier options, or minify plain JavaScript.
  • HTML Formatter — Beautify or minify HTML, format inline CSS/JS, and preview the result.
  • XML Formatter — Beautify, minify and validate XML, and convert XML ↔ JSON.
  • SQL Formatter — Format SQL for MySQL, PostgreSQL, SQL Server, SQLite, BigQuery and Oracle.
  • GraphQL Formatter — Format or minify GraphQL queries and schemas, validate syntax and extract operations.
  • Dockerfile Formatter — Format a Dockerfile and get best-practice / lint suggestions.
  • MongoDB Query Formatter — Format MongoDB shell queries and aggregation pipelines.
  • Contrast Checker — Check WCAG colour contrast ratio and AA/AAA pass for any two colours.

See all Code Formatters tools (32) · All tools