All free toolsUtilities

Live regular expression testing with capture group highlights and explanations.

17free utilities

Local processing limits: 50 MB per file, 20 files and 100 MB per selection. Some tools have stricter limits. Large or complex files can still exceed device memory.

Your files stay private·Nothing is stored or retained
Free, no sign-up·No watermark

Pattern

//

Test string

Replace

Cheat sheet

Highlighted matches

Matches

3 matches
#MatchIndexGroups
1[email protected]9$1=umair $2=cortexis $3=pk
2[email protected]28$1=sales $2=example $3=com
3[email protected]49$1=admin $2=site $3=org

Explanation

( capturing group
\w: a word character (letters, digits, _) — one or more times
)
"@": literal
( capturing group
\w: a word character (letters, digits, _) — one or more times
)
\.: the literal character "."
( capturing group
"com": literal text
| OR
"pk": literal text
| OR
"org": literal text
)

Processing and privacy: Regex Tester & Explainer

File processing runs in your browser. Your selected file is not uploaded by this tool. The website still receives ordinary page and asset requests. Keep your browser updated and review the output before sharing it.

File sizes and processing time depend on the tool and your device. Safety limits may apply; unlimited file sizes and instant completion are not guaranteed.

Complete Master GuidePublished by Cortexis Solution Hub Pvt Ltd Document Research Lab • 9 min read

How to Use a Regex Tester: Live Matches, Capture Groups, Replace Previews and Plain-English Explanations

A form that rejects a good email address. A log search that returns one line instead of forty. Each is a regex problem, and each is quicker to solve when you can see exactly what the pattern matches. This guide shows how to use the free regex tester above as a regular expression tester, a regex checker and a regex explainer in one screen, how to fix the usual reasons a regex is not working, and — honestly — what it does not do.

A hand writing notes beside printed text marked up with yellow and pink highlighters
Type a pattern, paste some text, and every match, group and replacement updates as you type.

1. What a Regex Tester Is, and When You Need One

A regular expression, or regex, is a compact pattern that describes text: “one or more digits”, “a word followed by an @ sign”, “anything between two square brackets”. A pattern that is slightly wrong still runs — it just matches the wrong thing.

A regular expression tester shows you the result straight away instead of after another edit-and-rerun cycle. This one is a javascript regex tester: it follows the JavaScript regular expression rules exactly, so what matches here is what matches in your front-end code and in Node. The rules are defined in the ECMAScript language specification, and the MDN regular expressions guide is the friendliest reference to them.

Use it to write a new pattern, to check an inherited one, to learn (it suits regex for beginners because every token is explained), or for a quick regex replace online.

2. How to Test a Regex in Four Steps

Here is how to test a regex with the tool above, which opens with a working example filled in.

  1. Type the pattern. Write it as you would between the two slashes of a regex literal. The regex cheat sheet underneath has 18 clickable tokens, from \d and [^abc] to named groups and lookbehind, which append themselves to your pattern.
  2. Pick the flags. Six checkboxes: g (global, on by default), i (ignore case), m (multiline), s (dotAll), u (unicode) and y (sticky). The d (indices) and v (unicodeSets) flags are not offered.
  3. Paste your test string. Use real samples, including a few values that should not match.
  4. Read the results. The regex match highlighter marks every match in yellow (an empty match shows as ∅), the Matches panel gives the count and a table of each match, its index and its groups, and the Explanation panel describes the pattern token by token.

Everything updates on every keystroke, so the fastest way to understand a pattern is to delete a piece and watch what changes.

3. Capture Groups, Named Groups and Regex Replace

Wrap part of a pattern in parentheses and it becomes a capture group; that is the whole answer to how to use capture groups in regex. The Groups column lists them as $1=, $2= and so on; a group that did not take part shows a dash. Use (?:...) to group without capturing.

Names are kinder than numbers. That is how to use named groups in javascript regex: write (?<year>\d{4}) and the table shows year=2026 alongside the numbered form. Refer back to it inside the same pattern with \k<year>.

The Replace section shows how to replace with regex in javascript before you write any code. It behaves exactly like String.replace with the same flags:

  • $1, $2 insert numbered groups, $<name> inserts a named one, and $& inserts the whole match.
  • Without the g flag, only the first match is replaced, just as in code.
  • The result can be copied, or downloaded as replaced.txt. To see exactly what changed, put the original and the result side by side in the diff checker.

JavaScript replacements cannot change letter case the way \U does in other flavours; for that, run the output through the case converter.

4. Regex Not Working? The Five Usual Causes

When a regex is not working, one small rule is usually doing something you did not expect.

  • The regex only matches the first occurrence: This is the missing g flag. Without g (or y), a JavaScript regex stops after one match. Untick g in the tool and watch the count drop to one.
  • Regex multiline not working: Without m, ^ and $ match only the start and end of the whole text. Without s, the dot will not cross a newline. Tick m for per-line anchors, s for patterns that span lines.
  • Regex greedy vs lazy: <.*> on <b>hi</b> matches the entire string, because * takes as much as it can. Add a question mark, <.*?>, and it matches each tag on its own. The explainer labels these “(lazy)”.
  • Backslashes lost in a string: A pattern that works here may fail in new RegExp("..."): inside a string, \d must be written \\d.
  • Invalid regular expression error in JavaScript: A message such as “Unterminated group” or “Nothing to repeat” means the pattern cannot be read. The tool shows that exact invalid regular expression error in red as you type, so the culprit is whatever you just added — often an unbalanced parenthesis.

Watch for runaway patterns. Nested quantifiers such as (a+)+ can take an extremely long time on text that almost matches, a problem known as catastrophic backtracking. The tool does not warn about it, and on large text the page can stop responding, so test risky patterns on a short sample first.

5. Worked Examples: Emails, Phones, Dates and Logs

Starting points to paste in and adapt, not universal answers.

  • Email regex tester: [\w.+-]+@[\w-]+\.[\w.-]+ finds everyday addresses; wrap it in ^ and $ to validate. No short pattern accepts every legal address, so aim to catch typos and confirm by email.
  • Phone number regex test: \+?\d[\d\s-]{7,14}\d allows an optional plus and spaces or hyphens. Paste the formats your users really type and adjust the range.
  • Regex for date format dd/mm/yyyy: ^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$ checks the shape (tick m for one date per line). It still accepts 31/02/2026, because a regex checks format, not the calendar, so confirm real dates in your own code. To turn dates into Unix timestamps or view them in another time zone, use the timestamp converter.
  • Extract text between two strings with a regex: START(.*?)END captures the middle in group 1; tick s if it spans lines. (?<=\[)[^\]]*(?=\]) matches only text inside square brackets — a quick regex lookbehind javascript check. Lookbehind is standard JavaScript and works here, both (?<=...) and (?<!...).
  • Regex tester for log files: ^(?<time>\S+ \S+) (?<level>ERROR|WARN) (?<msg>.*)$ with g and m pulls fields out of every matching line. Logs often hold customer details; pasted text is never stored on our servers.
  • Regex unicode property escapes test: \p{L}+ matches words in any script, where \w only knows unaccented Latin letters. It needs the u flag.

6. What This Regex Checker Does Not Do

Here is where this regex checker stops.

  • JavaScript flavour only. PCRE, PHP, Python, Java, Go and .NET patterns are not emulated. Possessive quantifiers, atomic groups (?>...), inline modifiers like (?i) and anchors such as \A or \Z will error or behave differently.
  • No saving, sharing or code generation. No permalinks, no pattern library, and it cannot write code or build a regex from examples.
  • No step-by-step debugger. No step counts, no d or v flags, and only each match’s start index. The table lists the first 200 matches; the count covers all.
  • Paste, not files. For line work on a whole file, such as removing duplicates or sorting, line tools accepts a dropped text file.
  • No test suites. Keep should-match and should-not-match lines in one test string, or compare outputs in the diff checker.

The explainer is a helper, not a full parser, and ignores flags. If a pattern arrives URL-encoded or inside escaped JSON, decode it with the URL encoder or the JSON formatter.

7. Why Use the Cortexis Regex Tester

Plenty of pages offer a regex tester online free. Here is what this one does differently.

Exact JavaScript results

A match here is a match in your front-end code and in Node. No flavour switch to set wrongly.

Everything on one screen

Highlighted matches, a group table with numbered and named captures, a replace preview and an explanation, all updating as you type.

Explained in plain English

Every token is described in words, indented to show nesting.

Your text stays private

Test strings and patterns are never stored on our servers and nothing is retained.

Nothing is used for training

What you paste is never used to train any model.

Free, no account

No sign-up, no email, no daily limit.

It is one of a wider set of free developer and document tools built on the same terms. If you have cleaned up a block of text with a replacement and want to know how long it is now, paste the result into the word counter.

8. Frequently Asked Questions (FAQ)

How do I test a regex online for free?

Type the pattern into the Pattern field of the tool at the top of this page, tick the flags you need and paste some sample text. Matches are highlighted as you type, with a group table and an explanation.

Why does my regex only match the first occurrence?

The g (global) flag is missing. Without g or y, a JavaScript regex stops after the first match. Tick g in the tool, or add it after the closing slash in your code.

Why is my regex multiline not working?

Without the m flag, ^ and $ match only the start and end of the whole text, not of each line. Without the s flag, the dot does not match a newline, so a pattern cannot run across lines. Tick m for per-line anchors and s for patterns that span lines.

What does this regex mean?

Paste it into the Pattern field and read the Explanation panel, which describes each token in plain English and indents groups to show nesting. It is a helper rather than a full parser, so it ignores flags.

Does it support lookbehind and named groups?

Yes. Lookbehind, both positive and negative, and named groups are part of the JavaScript standard and work here. Named groups appear in the Matches table as name=value and can be used in a replacement with $<name>.

Can I test PHP, Python or PCRE regex here?

No. The tool follows JavaScript regex rules only, so syntax such as possessive quantifiers, atomic groups, inline modifiers like (?i) or the \A and \Z anchors will error or behave differently. For those, test in that language.

Is it safe to paste logs or customer data?

Test strings and patterns are never stored on our servers, nothing is retained after your session, and none of it is used for training. As with any tool, paste only what you need: a few representative lines usually test a pattern as well as a whole log.

Can I save or share a pattern?

Not from this tool; there are no permalinks and no saved library. Copy the pattern somewhere safe, and download the replace result as replaced.txt.

Tidy a query with the SQL formatter, turn a spreadsheet export into structured data with the CSV to JSON converter, or inspect a token with the JWT decoder. And if you would rather write patterns like these in real applications, our free full-stack web development course and Python development course cover the everyday code where patterns like these end up.