# Test and debug a regular expression

> See each match, group and replacement as you type, with the pattern explained in plain English.

Test a regex against your text with live matches, groups and a plain-English explanation. Get JavaScript, Python and PHP code. Runs in your browser.

- Tool: [Regex tester](https://fixmint.cc/regex-tester)
- Category: [Web & developer](https://fixmint.cc/developer-tools)
- Fixes: Regex matches the wrong text
- Runs in the browser: files and text stay on the device, no sign-up, free.

## How to test a regular expression

1. Type the pattern and tick its flags.
2. Paste the text you want to match against.
3. Read the matches and the explanation, or copy the code for your language.

## Questions

### Is my text uploaded?

No. The pattern is compiled and run inside your browser, in a background worker. Nothing is sent to a server.

### Why does the tester say a pattern takes too long?

Some patterns backtrack exponentially on text that almost matches, such as (a+)+$ on a long run of a. The tester stops a run after one second. Simplify the repeat, for example a+ instead of (a+)+.

### Do JavaScript, Python and PHP differ?

Yes, in details. Python writes named groups as (?P<name>...) and has no \p{...} without a third-party module. PHP wraps the pattern in / delimiters and needs the u flag for Unicode matching. The code tabs show each change.

### What do $1, $<name> and $& mean in a replacement?

$1 is the text of the first group, $<name> the text of a named group and $& the whole match. Each language writes the same replacement its own way.

## Related tools

- [Extract emails and links](https://fixmint.cc/extract-emails-links): Pull emails out of a page
- [Find and replace](https://fixmint.cc/find-and-replace): Replace a word everywhere
- [Format JSON](https://fixmint.cc/json-formatter): JSON won’t parse
- [Change case](https://fixmint.cc/case-converter): Text is in the wrong case
