Regex Tester

//

The highlighted match result will appear here...

Matches will appear here after you click Test...

The regex syntax breakdown will appear here...

How to use the Regex Tester

Test a regular expression against your own text and see every match highlighted instantly, together with the captured groups and a plain-language explanation of the pattern. It uses the JavaScript regular expression engine of your browser, and your text never leaves your device.

Step by step

  1. Type your regular expression into the Regular Expression Pattern box, without the surrounding slashes. For example: ^\d{3}-\d{4}$
  2. Tick the flags you need: Global (g) finds every match, Ignore Case (i), Multiline (m), Dot All (s), Unicode (u) and Sticky (y).
  3. Paste the text you want to search into the Test String box.
  4. Click Test. A badge shows Match found with the number of matches, or No match.
  5. Look at Highlighted Text to see where the matches are, at the Matches list for the position and captured groups of each one, and at Syntax Explanation to understand each part of your pattern.
  6. Click Clear to reset everything.

Tips

  • Without the Global (g) flag, only the first match is returned.
  • If the pattern is not valid, a red message from the regex engine explains the error.
  • To keep your browser responsive, the pattern can be up to 500 characters, the test string up to 20,000 characters, and at most 1,000 matches are listed.
  • Patterns with heavy nested repetition, such as (a+)+$, can be very slow on long text. If the page seems to hang, simplify the pattern.

Good to know

A regular expression describes a pattern of text. The tester runs your pattern with the JavaScript regex engine, highlights every match and shows what each capturing group matched, so you can adjust it until it behaves as intended.

Flags change how a pattern is applied: g finds every match, i ignores case, m makes ^ and $ work per line, s lets the dot match line breaks and u enables full Unicode matching.

When to use it

  • Building a pattern to validate or extract text such as dates, codes or identifiers.
  • Debugging why a pattern matches too much or too little.
  • Learning regex by seeing each match highlighted live.

Example: Extracting parts of a date

Input

Pattern: (\d{4})-(\d{2})-(\d{2})
Text:    Released on 2026-11-01.

Result

Match:   2026-11-01
Group 1: 2026   Group 2: 11   Group 3: 01

Common mistakes

  • Forgetting the g flag and getting only the first match.
  • Using . to mean a dot. A dot matches any character, so escape it as \. for a literal dot.
  • Greedy quantifiers that match too much, such as .* between two tags. Use the lazy form .*? instead.
  • Nested quantifiers such as (a+)+ that can cause catastrophic slowdowns on some input.

Frequently asked questions

Which regular expression syntax does it use?
The JavaScript RegExp engine of your browser. Patterns written for PCRE, Python or Java can behave differently, and features such as atomic groups or possessive quantifiers are not available.
What do the flags mean?
g finds all matches, i ignores case, m makes ^ and $ match at each line, s lets the dot match line breaks, u turns on Unicode mode, and y matches only at the exact position where the search starts.
Why do I get only one match?
Without the Global (g) flag, only the first match is returned. Tick Global to find all matches.
Are there limits?
The pattern can be up to 500 characters, the test text up to 20,000 characters, and at most 1,000 matches are listed. This keeps your browser responsive.
Why does the page become slow with some patterns?
Patterns with nested repetition such as (a+)+$ can take extremely long on long text, which is called catastrophic backtracking. Simplify the pattern if the page seems to hang.
Is my text sent to a server?
No. The test runs entirely in your browser.

Related searches: test regular expression online with match highlighting · javascript regex tester with explanation · regex tester with capture groups · regex101 alternative

Tìm kiếm liên quan: công cụ kiểm tra biểu thức chính quy online · test regex javascript có tô sáng kết quả · giải thích cú pháp regex · kiểm tra regex có nhóm bắt capture group