Web / JavaScript

JavaScript RegExp Tester

Test regular expressions directly in the browser against sample text. The tool shows matches, groups, positions and replacements, and creates copyable JavaScript code.

Test a regular expression

Enter a pattern without leading and trailing slashes, choose the required flags and paste sample text. The test runs completely locally in the browser.

Example: \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b

Flags
Status
0 Matches
0 Groups per match

Match highlighting

Match list

No. Index Length Match Groups

JavaScript code

Replacement / export

Tips for JavaScript RegExp

Enter the pattern without delimiters

Write only the pattern itself. For /abc/gi, enter abc and enable the g and i flags.

Use the global flag for multiple matches

A full match list usually needs the g flag. Without g, JavaScript only finds the first match.

Test replacements

The optional replacement text lets you check how String.replace changes the sample text.