Internative Logo

Regex Tester: Test and Debug Regular Expressions in Your Browser

Regex Tester: Test and Debug Regular Expressions in Your Browser

A regular expression, or regex, is a short pattern that describes text: an email address, a date, an order number. The tester below runs your pattern against your own text as you type and highlights every match. It all runs in your browser, so nothing you paste is sent anywhere.

Regex tester

Type a pattern, pick the flags and paste your text. Matches are highlighted as you type, and everything runs in your browser.

Flags

Result

3 matches

Write to hello@example.com or sales@example.org.
Old address: info@example.net (no longer read).
  1. hello@example.comat 9
  2. sales@example.org.at 30
  3. info@example.netat 62

The pattern and the text never leave your browser.

How to use the tester

  1. Type your pattern in the Pattern field, without the surrounding slashes.
  2. Switch on the flags you need.
  3. Paste your text into the Test text field.

Matches are highlighted in the text and listed under it with their position and any capture groups. If the pattern is not valid, the tester shows the message from the browser's own regex engine, which usually points at the problem, such as an unclosed bracket.

The tester uses the JavaScript regex engine (ECMAScript), the one your browser and Node.js run. Python, PHP (PCRE) and .NET agree on most everyday syntax but differ in details such as lookbehind, named groups and Unicode classes, so check a pattern in the engine you will deploy to before you rely on it.

What the flags do

  • g (global): find every match instead of stopping at the first.
  • i (ignore case): treat upper and lower case letters as the same.
  • m (multiline): make ^ and $ match at the start and end of each line, not only of the whole text.
  • s (dotAll): let . match a line break too.
  • u (unicode): treat the text as Unicode, which matters for emoji and many scripts.

Patterns you will reuse

  • \d{4}-\d{2}-\d{2}: a date written as 2026-12-02.
  • [\w.+-]+@[\w-]+\.[\w.]+: a string shaped like an email address. It finds candidates in a text; it cannot tell you whether an address exists.
  • \b[A-Z]{2,}\b: words written in capitals, such as API or HTTP.
  • (\d+)\s*(kg|lb): a number followed by a unit, captured as two groups.
  • ^\s+|\s+$: spaces at the start or end of a text, handy for trimming.

Common mistakes

  • An unescaped dot. . matches any character. To match a literal dot, write \..
  • Greedy matching. In <.+> the + takes as much as it can, so one match can swallow several tags. <.+?> stops at the first closing bracket.
  • Anchors without the m flag. ^ and $ refer to the whole text unless m is on.
  • Catastrophic backtracking. A pattern with nested quantifiers, such as (a+)+$, can take exponentially longer on a text that almost matches. The tester stops a pattern that runs too long. In production code, avoid such patterns and limit the length of the input.
  • Validating complex formats. A regex for email addresses or URLs either rejects valid ones or accepts invalid ones. Use it to find candidates and let a library or a confirmation step decide.

When a regex is not enough

A regex is a good tool for finding and extracting well-defined strings. For nested structures such as HTML, JSON or source code, use a parser. When the text varies too much for any pattern, such as contracts, support emails or invoices with changing layouts, a language model is often the better fit.

If text processing is slowing down a product or a workflow of yours, we build software for exactly that: see custom software development and AI integration and automation.

Frequently asked questions

Does my text leave my browser?

No. The pattern and the text are processed in the page on your device. The tester makes no network request with them and does not store them.

Which regex flavor does this tester use?

JavaScript (ECMAScript), the engine built into your browser. If your code runs in Python, PHP, Java or .NET, test the final pattern there as well, because some syntax differs between engines.

Why does my pattern work here but not in my code?

The usual causes are a different engine, a missing flag, or escaping. In many languages a backslash in a string literal must be doubled ("\\d+") or the string written as a raw string.

Why was my pattern stopped?

The tester ends a search that runs longer than about a second and a half and reports it. That usually means catastrophic backtracking: look for nested quantifiers or alternatives that can match the same text in several ways, and make them more specific.

Is there a limit on the text?

Yes. To keep the page responsive, the tester accepts patterns up to 500 characters and texts up to 20,000 characters, and it lists the first 200 matches.

Related services

Where this topic becomes an engagement.

Keep reading

The articles that follow this one.