Regex Tester

Lets you try a regular expression against sample text and see every match highlighted, with its position and any capture groups. Use it to build and debug a pattern before putting it into code, a search-and-replace or a form validation rule.

Options

JavaScript syntax, without the surrounding slashes. Maximum 1,024 characters.

Up to 100 KiB.

Results

Results appear here.

How to use the Regex Tester

  1. Enter a regular expression in Regular expression, without the surrounding slashes.
  2. Choose flags, then paste the text to search into Test text.
  3. Select Test pattern. Matches are highlighted, and the table lists each match, its position and any capture groups. Copy result copies the list of matches.

Safety limits

  • Patterns run in a separate background process and stop after 1 second, so a slow pattern cannot freeze the page.
  • Up to 1,000 matches are shown. Test text is limited to 100 KiB and patterns to 1,024 characters.

Limitations

  • The tool uses your browser’s JavaScript regular expression engine. Other languages (PCRE, Python, .NET) support different features.
  • Positions are counted in JavaScript string units: characters outside the Basic Multilingual Plane, such as most emoji, count as 2.

Worked examples

Find order numbers

Input

Order #123 shipped on 2026-12-04; order #456 is pending.

Result

#123
#456
Named groups for year and month

Input

Invoices: 2026-12-04, 2027-01-15

Result

2026-12
2027-01

Practical uses

  • Checking a pattern before using it

    A developer drafts a pattern to pull order numbers from a log, but is unsure it catches only the right lines. They paste a few sample lines into Test text and select Test pattern to see the highlighted matches. Once the results look right, the pattern can go into code with more confidence.

  • Understanding capture groups

    A student learning regular expressions finds capture groups confusing. They run a pattern on a short example and read the match table, which lists each group and where each match starts. Seeing the groups laid out makes it easier to understand what the brackets do.

  • Finding why a pattern misses lines

    An analyst's pattern skips some entries in a list of records. They paste sample lines and switch the flags on and off, one at a time, until more lines are found. The test shows that case sensitivity was the cause, so the fix is a single flag.

Privacy: this tool runs entirely in your browser. Your text is not uploaded, logged or saved, and it is never sent to analytics. Maximum input: 100 KiB.