How to Use the Regex Tester: Steps and a Worked Example

By 1 min read

Test a JavaScript regular expression against sample text and list matches. This guide shows what to enter, a worked example, and the limits to keep in mind. The Regex Tester tool is free, needs no account and runs in your browser.

What you need

  • Regular expression, for example \btool\w*
  • Test text, for example Useful tools make work easier. This tool checks a pattern.
  • Flags (g, i, m, s, u), for example gi

Step by step

  1. Open the Regex Tester tool.
  2. Fill in Regular expression.
  3. Fill in Test text.
  4. Fill in Flags (g, i, m, s, u).
  5. Read the result, which updates as soon as the inputs change.

Worked example

With these inputs:

  • Regular expression: \btool\w*
  • Test text: Useful tools make work easier. This tool checks a pattern.
  • Flags (g, i, m, s, u): gi

the tool returns:

Match 1: “tools” at index 7
Match 2: “tool” at index 36

How it works

The calculation is: JavaScript RegExp. Everything runs in your browser, so nothing you type is uploaded.

Things to keep in mind

Uses JavaScript regular-expression syntax. Patterns can be computationally expensive; avoid untrusted patterns on huge text.

If this is not quite what you need, try Regex Escape Helper, JSON Formatter or JSON Validator.

More from the blog