wid9et
Sign In

Regex Tester

Test JavaScript regular expressions against sample text and inspect matches, positions and capture groups.

Enter the pattern without / / characters. Example: \\b\\w{4}\\b matches four-letter words.

Flags (optional)

How to use Regex Tester

  1. 1Enter a JavaScript regular expression pattern without surrounding slash characters.
  2. 2Choose the flags you want, then paste or type the text you want to test.
  3. 3Run the test to see highlighted matches, character indexes, capture groups and named groups.

Useful tips

  • •Enable g (global) when you want every match. Without g, JavaScript stops after the first match.
  • •Use m when ^ and $ should work per line, s when a dot should also match line breaks, and i for case-insensitive matching.
  • •Backslashes are entered normally here. If you later put the pattern inside a JavaScript string, that string may require additional escaping.

Frequently asked questions

Which regular expression syntax does this tester use?

It uses your browser's JavaScript RegExp engine, so syntax and flag support follow the JavaScript implementation in that browser.

Why does turning off g show only one match?

That mirrors JavaScript RegExp behaviour: without the global flag, a normal exec operation returns the first match only.

What are capture groups?

Parentheses can capture parts of a match for later use. Named groups use syntax such as (?<name>...) and are shown separately when present.

Can a regex freeze the browser?

A badly designed expression can take a very long time on certain input. This tool tests only when you press Test Pattern rather than rerunning on every keystroke, but complex or untrusted patterns can still be expensive.

Is my test text uploaded?

No. Matching happens in your browser using JavaScript's RegExp engine, so Wid9et does not need to upload the text to test the expression.