Skip to content
NSNormandin SystemsTHE EVERYDAY TOOLBOXMain site
Aa

Text / YOUR EVERYDAY TOOLBOX

Regex Tester

Test your regular expressions with sample text.

✓ Free to use✓ No account neededHow to use this tool ↓
YOUR WORKSPACESee an example ↗

Opening your tool…

Runs in your browser. Check important results and keep a copy of your original files.

THE PRACTICAL GUIDE · NORMANDIN SYSTEMS

Get more from Regex Tester

Regex Tester evaluates a JavaScript regular expression against sample text and displays matches, their positions, captures, and named groups. The workspace has separate fields for the pattern and text, checkboxes for matching flags, a generated sample, and a visual diagram. It does not edit or replace the input document. Use it to establish which strings a pattern matches and which it rejects before moving that pattern into application code. A useful test contains both positive and negative cases, because matching one desired word does not show whether the expression also accepts unintended content. The surrounding runtime, flags, and string-escaping layer remain part of the final behavior.

Guide updated October 13, 2026

How to use this tool

  1. Enter the expression in the regex field and the test passage in the separate text field. Use the pattern itself, such as \bcat\b, rather than a programming-language string containing extra escaping.
  2. Choose the flags deliberately: Global search, Case insensitive search, Multiline, Singleline, and the relevant Unicode mode. For all matches in the example, keep Global search enabled.
  3. Inspect the Matches table, including Index, Value, Captures, and Groups. Compare both expected matches and text that should remain unmatched.
  4. Use the generated sample and diagram as supporting aids, then test the expression with the same flags in the actual JavaScript API or other target runtime.

SEE IT IN PRACTICE

A worked example

EXAMPLE INPUT
Pattern: \bcat\b
Text: cat scatter cat
Global search: enabled
RESULT / WHAT TO EXPECT
Two matches: cat at index 0 and cat at index 12

The word boundaries exclude the letters cat embedded in scatter. Global search requests both standalone occurrences. The original text is not transformed or replaced.

Flags change what matching means

Case-insensitive matching changes letter-case comparisons. Multiline affects how start and end anchors relate to line boundaries; Singleline, also known as dotAll, changes whether a dot can match a newline. These are different decisions despite their similar names. The workspace initially enables global, dotAll, and Unicode modes, while saved settings can alter the active choices. Read the checkboxes before comparing results with another tester or with a code example.

Match indices and capture boundaries help explain where the engine found a result. In JavaScript, string indexing is based on UTF-16 code units, so an index is not always a count of human-perceived characters when emoji or other supplementary characters appear.

Design tests around rejection as well as acceptance

For a whole-value validator, include extra leading and trailing text to verify that the expression is actually anchored as intended. For extraction, include adjacent punctuation and repeated occurrences. Reduce a failing pattern to a small fragment and add complexity back gradually. Long near-matches are useful for exposing expensive backtracking. A diagram explains structure, but it does not establish performance or prove that the pattern implements every business rule the application requires.

When this tool is useful

  • Debug a validation expression with positive and negative samples
  • Inspect capture boundaries and named groups
  • Check the effect of global, multiline, and case-insensitive flags

Tips for a better result

  • Test an empty value, a near-match, punctuation, a newline, and a long nonmatching string where those cases matter to the application.
  • Unicode and Unicode sets correspond to distinct JavaScript modes. Do not enable both u and v simultaneously; that is an invalid flag combination.
  • A generated example is not an exhaustive test set. Confirm the pattern against your own real boundary cases and intended flags.

Frequently asked questions

Does the tester replace matched text?

No. This workspace reports matches and provides a sample and diagram. Replacement behavior belongs to a separate operation in your application or editing tool, where replacement-string rules also need testing.

Why does only one occurrence appear?

Check Global search and the pattern's boundaries. Without a global search, a matching API may return only the first match. With global enabled, anchors, lookarounds, or other pattern constraints can still exclude later occurrences.

Why does the pattern behave differently inside source code?

A pattern entered directly is not necessarily written the same way inside a language string. Backslashes may need another escaping layer, flags may differ, and another language may use a different regex engine. Test the exact source representation and API used by the application.

What happens to the information I enter?

The utility processes your input in this browser. Some tools retain field values in browser storage or the URL; avoid entering secrets in shareable fields. Page and asset requests still go to the hosting provider. Read the privacy and offline-use notes for details.