Developer tool

Regex Tester Online

Test JavaScript regular expressions against sample text, inspect capture groups, and preview replacements as you edit.

Patterns:
Regular Expression Pattern -
/ / g
Flags:
Test String 0 chars | 0 lines
// Highlighted matches will appear here...
# Match Text Index Groups ($1, $2...)
No match groups extracted
Replacement String:

How to use this tool

  1. Enter a regex pattern and select the flags your application uses.
  2. Paste representative text and inspect the highlighted matches and capture groups.
  3. Try non-matching cases and replacement text before using the pattern in your code.

Example and use case

Pattern: \b[A-Z]{2}-\d{3}\b with the global flag. Sample text: AB-123 and XY-456.

Limitations to check

The engine follows JavaScript regex syntax; PCRE, Python and other engines differ. Complex patterns can freeze the browser through excessive backtracking. Keep adversarial samples small and avoid treating a regex as a complete security validator.

Processing and privacy

The tool's browser code handles entered text or selected files locally. Optional URL imports and external resources can make network requests. This website also uses third-party scripts, including analytics and advertising. Read the privacy policy and use sample data when testing sensitive workflows.

Found a problem? Report a tool issue with the browser version and steps to reproduce it. Avoid sending private document content or credentials.

Frequently asked questions

Why does my PCRE pattern fail here?

This tool uses the browser's JavaScript regex engine. Features and escaping rules can differ from PCRE or another server-side engine.

What does the global flag do?

The g flag searches for successive matches instead of stopping at the first one.

Why can a regex test take a long time?

Some patterns perform excessive backtracking on particular input. Simplify nested repetitions and bound input size.

Related tools