# Regex Tester — Test JavaScript Regular Expressions

> Test JavaScript regular expressions with flags, capture groups, match indexes, and replacement previews in your browser.

Source: https://toolpantry.app/regex-tester

## About

Try a JavaScript regular expression against sample text, inspect capture groups, and preview a replacement without sending the text anywhere.

## Quick answer

**How do I test a regular expression?** Paste a pattern and test text to see matches and groups highlighted live.

## How to test a regular expression

1. **Enter your pattern** — plus the sample text to run against it.
2. **Read the highlights** — matches, capture groups, and indexes are shown live.
3. **Try the replacement** — preview substitutions before putting the regex into code.

## When this saves you

- Building validators (emails, phone numbers, IDs) with real samples
- Debugging log parsers that mysteriously skip lines
- Verifying a search-and-replace before running it in bulk

## Good to know

This uses JavaScript regex flavor — most patterns port to other languages, but not all. Always test the boring edge cases (empty string, unicode, trailing newline), and keep patterns specific: vague ones like .* repeated can cause catastrophic backtracking and freeze a tab. Related: [SQL formatter](https://toolpantry.app/sql-formatter) for query cleanup.

## Notes

This tester uses the JavaScript RegExp engine. Patterns and test text stay in your browser; a maximum input size keeps accidental runaway patterns manageable.

## FAQ

**Which regex syntax is supported?**

This page uses the regular expression syntax built into your browser's JavaScript engine, including flags such as g, i, m, s, u, and y.

**Why are there no matches?**

Check the pattern, flags, and whether you need a global g flag for repeated matches.
