ToolHive

Regex Tester

Enter a regular expression and some sample text to instantly see every match highlighted, along with capture groups and a total match count.

How to use

  1. 1

    Enter your regular expression

    Type the pattern, without the surrounding slashes (e.g. \d+ not /\d+/).

  2. 2

    Set any flags

    Add flags like i for case-insensitive matching, if needed.

  3. 3

    Paste sample text

    Add the text you want to test the pattern against.

  4. 4

    Review matches

    Matches are highlighted inline, with a count and any capture groups listed below.

Examples

  • Pattern \d+ on "Order 12 has 5 items" → matches "12" and "5"
  • Pattern (\w+)@(\w+\.com) on "me@test.com" → captures group 1 "me", group 2 "test.com"

Frequently asked questions

What flags can I use?

Any valid JavaScript regex flag: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), and y (sticky). The global flag is applied automatically so all matches are found, even if you don't type it.

How are capture groups shown?

If your pattern includes parentheses (capture groups), each match lists the captured text for every group below the highlighted text, in order.

What happens with an invalid regex?

If the pattern can't be compiled (e.g. unbalanced parentheses), a clear error message from the JavaScript regex engine is shown instead of crashing.

Is my text or pattern sent anywhere?

No. Matching runs entirely in your browser using JavaScript's built-in RegExp engine. Nothing is sent to a server or saved.

Related tools

← Back to Developer Tools