Pro Every tool, icon and stickerAll of Pro for $5.99/month

  • All 85 tools
  • Festival Post Maker
  • Icon & sticker pack ZIPs
Go Pro
HubToolify
Developer Tools

Regex Tester Pro

Write a JavaScript regular expression and see what it matches in your own sample text, group by group. Matching runs in a background worker, so a pattern that never finishes is stopped instead of hanging the page. Free preview · Pro required to export. Test patterns against up to 3,000 characters of text free. Pro removes this limit.

Free preview · Pro required to export. Test patterns against up to 3,000 characters of text free. Pro removes this limit.

Loading…

Why use this tool?

  • A pattern that looks right often matches too much or too little, and the quickest way to find out is to see the hits highlighted in real text.
  • Capture groups are hard to reason about in your head; a table showing each match with its $1, $2 and named groups shows what a replace will actually use.
  • Nested quantifiers such as (a+)+ can run for minutes on the wrong input. Finding that out in a test tab is better than finding it in production.
  • Starting from a working pattern for an email, URL or date is quicker than writing one from memory.

How to use Regex Tester

  1. Enter the expression between the slashes in the Pattern field, without the slashes themselves.
  2. Toggle the flags you need: global, ignore case, multiline, dot matches newline, unicode or sticky.
  3. Paste your sample into Test against. The text below Matches shows every hit highlighted.
  4. Check the Match by match table for each match's position and capture groups.
  5. To preview a substitution, tick Show what a replacement would do and type the Replace with text, using $1, $<name> or $&.
  6. Click Copy matches to put the matched strings on your clipboard, one per line.

Features

  • Live results about 200 ms after you stop typing
  • Six flags: g, i, m, s, u and y
  • Highlighted matches inside the original text
  • Per-match table with index, full match and numbered capture groups, and a list of named groups
  • Replacement preview with $1, $<name>, $& and $$
  • Nine starter patterns: email, URL, IPv4, ISO date, hex colour, slug, HTML tag, duplicate word and named groups
  • One-second time limit that stops catastrophic backtracking
  • Counts of matches, groups and named groups

Supported formats

Uses the JavaScript (ECMAScript) regular expression engine of your browser, so syntax such as lookbehind and \p{...} follows what that browser supports. Input is plain text; output is highlighted text, a table and, optionally, the replaced text.

Tips

  • A pattern that is stopped after a second usually has nested quantifiers like (\w+)* or (a+)+; rewrite it so only one quantifier can claim a given character.
  • Turn on the m flag when you use ^ and $ to mean the start and end of each line rather than of the whole text.
  • Add the u flag before using \p{L} or other Unicode property escapes.
  • The table lists the first 50 matches and the engine reports at most 2,000, so test large inputs in a smaller slice.

Frequently asked questions

Which regex flavour does this use?

JavaScript's. A pattern that works here will work in JavaScript, but PCRE, Python or .NET features that JavaScript lacks, such as possessive quantifiers, will give an error.

Is my text sent anywhere?

No. The pattern and the text are processed in a Web Worker inside your browser tab and are not sent to a server.

Why did I get a message about catastrophic backtracking?

The pattern ran for more than one second, which usually means it tries an enormous number of ways to match text that does not fit. It was stopped so the page would stay usable; simplify the quantifiers and try again.

How do I use a capture group in the replacement?

Switch on the replacement preview and write $1 for the first group, $<name> for a named group, $& for the whole match or $$ for a literal dollar sign.

What does the sticky flag do?

With y, a match is only accepted at the exact position where the search starts, instead of scanning ahead for the next one. Most everyday patterns do not need it.

Why does it say nothing matched when my pattern is valid?

The notice only means the pattern parsed correctly and does not occur in your text. Check the flags, in particular case sensitivity and whether g is on.

Can I try this Pro tool without an account?

Yes. Test patterns against up to 3,000 characters of text free. Pro removes this limit. Your own input is processed locally in your browser.

Will upgrading keep my work?

Checkout and login open in a separate tab. Keep the workspace open to retain inputs, settings and previews. Files stay in that tab only; keep the originals in case you close or reload it. Export access is checked with the server after payment.

Your files are processed directly in your browser and are not uploaded to HubToolify's servers.