Skip to content
FreeRuns in your browserFeatured

Regex Tester

Test JavaScript regular expressions live, with highlighted matches, capture groups and flag toggles.

Use the Regex Tester

Loading tool...

What is the Regex Tester?

A regular expression (regex) is a compact pattern language for matching text. Developers use regexes to validate input, extract values from logs, search and replace in editors, and route URLs. They are powerful but easy to get subtly wrong, which is why testing a pattern against real samples before putting it in code is worth the minute it takes.

This tester uses the JavaScript regular expression engine, so behaviour matches what you will get in the browser and in Node.js. Flags change how a pattern works: g finds all matches, i ignores case, m makes ^ and $ match at line boundaries, s lets . match newlines, and u enables full Unicode matching.

When to use the Regex Tester

Build and verify patterns here before they reach your codebase: validating form fields, extracting IDs or dates from logs, rewriting URLs, cleaning data with search and replace, or splitting text by a complex delimiter. Testing against several realistic samples, including inputs that should not match, catches the bugs that otherwise show up in production. It is also a good place to learn, because the instant highlighting makes the effect of each quantifier, anchor and group visible while you experiment.

How to use the Regex Tester

  1. Enter your pattern between the slashes, without the surrounding / characters.
  2. Toggle the flags you need, such as g and i.
  3. Paste sample text into the test area.
  4. Matches are highlighted live; the list below shows each match, its index and capture groups.
  5. Refine the pattern until only the intended text matches, then copy it into your code.

Examples

Pattern:  (\d{4})-(\d{2})-(\d{2})
Flags:    g
Text:     Released 2026-10-02, patched 2026-10-15.

Match 1:  2026-10-02   groups: 2026, 10, 02
Match 2:  2026-10-15   groups: 2026, 10, 15

Named groups:  (?<year>\d{4})-(?<month>\d{2})
Email (simple):  [^\s@]+@[^\s@]+\.[^\s@]+

Common errors and tips

  • Greedy vs lazy: .* grabs as much as possible; use .*? to stop at the first possible end.
  • Escape special characters like . ? + * ( ) [ ] { } | \ ^ $ when you want them literally.
  • Catastrophic backtracking from nested quantifiers such as (a+)+ can freeze a page; keep patterns simple.
  • A pattern with the g flag keeps state in lastIndex when used with .test() repeatedly, a frequent source of confusing bugs.
  • Do not validate email addresses or HTML with a regex alone; use a proper parser or confirmation email.

Privacy: runs entirely in your browser

Patterns and sample text, which may include log lines or customer data, are evaluated locally in your browser and never uploaded. This tool runs entirely in your browser: nothing you enter is uploaded, stored or logged on our servers, and it keeps working even if you go offline after the page has loaded.

Frequently asked questions

Which regex flavour does this tester use?

The JavaScript (ECMAScript) engine built into your browser. Lookbehind, named groups and Unicode property escapes work in modern browsers.

What do the g, i, m, s and u flags mean?

g finds all matches, i ignores case, m makes ^ and $ match per line, s lets the dot match newlines, and u enables Unicode mode.

Why does my regex match too much?
Quantifiers like * and + are greedy. Add ? to make them lazy, or use a more specific character class instead of the dot.
How do I match a literal dot or bracket?
Escape it with a backslash, for example \. or \[.
What are capture groups?
Parentheses create groups that save the matched portion. They let you extract parts of a match, and named groups like (?<year>\d{4}) make the result easier to read.

Ratings & reviews

–

0 reviews

5 star
0 reviews (0%)
4 star
0 reviews (0%)
3 star
0 reviews (0%)
2 star
0 reviews (0%)
1 star
0 reviews (0%)

No reviews yet — be the first to share your experience.

Write a review

Reviews are moderated before they appear.

Your rating *

Photos or videos (optional)

Drag files here or

JPG, PNG, WebP, GIF up to 5 MB. MP4 or WebM up to 25 MB.

  • Featured

    Beautify, minify and validate JSON instantly, with exact line and column for every syntax error.

    Use tool
  • Featured

    Encode text to Base64 or decode Base64 back to readable UTF-8, including URL-safe Base64.

    Use tool
  • Featured

    Generate random v4 and time-ordered v7 UUIDs in bulk, with one-click copy and format options.

    Use tool
  • JWT Decoder

    Developer

    Featured

    Decode JSON Web Tokens to inspect the header, payload and expiry, all without sending the token anywhere.

    Use tool
  • Featured

    Convert Unix timestamps to readable dates and back, in UTC or your local timezone, in seconds or milliseconds.

    Use tool
  • Turn an array of JSON objects into a clean CSV file for Excel or Google Sheets in one click.

    Use tool