BestOnline.ToolsBestOnline.Tools

Free online regex tester

Test a JavaScript regular expression against your text and see the matches, positions and capture groups. Edit the pattern or flags to refine the result. Free to use, with no account required.

🔒Your text stays on your device. This tool processes it in your browser.

How It Works

Find matching text with a JavaScript regular expression, then inspect what each match captures. Enter the pattern without surrounding slashes, choose flags and paste your test text. Results update after you edit, showing the matched value and its starting position.

To try a simple example, enter \d+ with the g flag and the text “Order 42, batch 7”. The tester finds 42 at position 6 and 7 at position 16. Remove g to return just the first match. Add i when your pattern should ignore letter case.

Capturing groups let you inspect parts of a match. Try (?<code>[A-Z]{2})-(?<number>\d+) against AB-42 to see both numbered groups and the named code and number values. An optional group that does not participate is labelled “Not matched”.

Matching runs locally in a separate browser worker. Slow patterns are stopped after one second so you can revise the expression. The result list shows up to 1,000 matches from up to 100,000 text characters.

Features

  • ✓Live JavaScript regular expression testing
  • ✓Matched text and zero-based starting positions
  • ✓Numbered and named capture groups
  • ✓Global, case-insensitive, multiline and other browser-supported flags
  • ✓Empty-match and unmatched-group distinctions
  • ✓Invalid-pattern errors and a time limit for slow tests

How to Use This Tool

  1. Enter the expression without surrounding slashes.
  2. Choose flags: start with g for repeated matches, or gi to ignore case as well.
  3. Paste sample text containing matches and non-matches.
  4. Inspect the match values, positions and groups, then adjust your pattern or flags.

Perfect For

  • →Extract reference numbers or codes from copied text.
  • →Check which values an optional or named group captures.
  • →Try an input-format pattern against valid and invalid examples.
  • →Find why a pattern matches once, ignores case or crosses line breaks.

Frequently Asked Questions

Enter the pattern without surrounding slashes in Regular expression, put flags such as g or gi in Flags, then paste the text to search. The results update after you edit. Each match shows its value, starting position and any captured groups.

More Developer and data tools

All Developer and data tools →