Skip to main content
HandyWeb

Regex Tester

Test a JavaScript regular expression on text, see the matches and groups, and get a warning for slow patterns. It works with Persian text and \p{…} too.

Runs on your device.

Flags
0 characters0 bytes

How to Use It

  1. Write the pattern and choose the flags.
  2. Paste the test text. Matches are highlighted as you type.
  3. See the position and the groups of each match in the table.

Questions and Answers

Why does \d not match Persian digits?

In JavaScript, \d is only the Latin 0 to 9. For Persian digits, use [۰-۹], or \p{Nd} with the u flag.

What is catastrophic backtracking?

A pattern such as (a+)+ tries a huge number of paths on text that almost matches, and its time grows exponentially. This tool runs each pattern in a separate worker and stops it after 2 seconds, so the page does not freeze.

Good to Know

Patterns run with the JavaScript regex engine of your browser, which can differ from PCRE, Python, or Go. Each run stops after 2 seconds. Positions count UTF-16 code units.

Source code of this toolReport a problem on GitHub