T

Text Machine

Powerful text tools, in your browser

Regex Tester

Build and test regular expressions against your own text in real time. See every match highlighted, inspect capture groups, and preview replacements — all in your browser.

Regular expression

/

/g

Flags

Test string
Replace with

Tip: enable the g flag to replace every match instead of only the first.

How to use Regex Tester

  1. 1

    Write your pattern

    Type a regular expression in the pattern field, then toggle the flag chips (g, i, m, and more) to control exactly how matching works.

  2. 2

    Add your test text

    Paste the text you want to search into the “Test string” box. Matches are highlighted instantly as you type or edit the pattern.

  3. 3

    Inspect the matches

    Review each match, its position in the text, and any capture or named groups in the results list to confirm the pattern behaves as expected.

  4. 4

    Replace or copy

    Enter a replacement to preview substitutions with $1-style backreferences, then copy the result straight into your code or document.

Frequently asked questions

What is a regular expression?
A regular expression, or regex, is a compact pattern used to search, match, and transform text. Developers rely on them for input validation, search-and-replace, parsing, and data extraction in almost every programming language and text editor.
Which regex flavor does this tester use?
This tool uses the JavaScript (ECMAScript) regular expression engine built into your browser — the same engine used by Node.js and modern web apps. Patterns and flags behave exactly as they would in your own JavaScript code.
What do the flags mean?
g (global) finds every match instead of stopping at the first, i ignores letter case, m makes ^ and $ match at line breaks, s lets the dot match newline characters, u enables full Unicode handling, and y (sticky) anchors matching to a specific position in the text.
How do capture groups work?
Parentheses in your pattern create capture groups that pull out parts of each match. Numbered groups are referenced as $1, $2, and so on, while named groups written as (?<name>…) are listed separately, so you can extract exactly the data you need.
Is my data sent to a server?
No. Every match and replacement runs entirely in your browser using its native regex engine. Nothing you type is uploaded, logged, or stored, so the tester works offline and keeps your text completely private.

Related tools

Keep going with these handy tools

HTML to Text Converter

JSON Formatter

JWT Decoder

CSS Gradient Generator

CSS Box Shadow Generator

Text to HTML Converter