# Regex Tester

A regex tester that highlights every match as you type, names capture groups, previews a replacement and stops a runaway pattern before it freezes the tab.

Canonical page: https://filetity.com/regex-tester

## Capabilities

- Free: Yes, with no watermark and no page limit.
- Account required: No. There is no account system.
- Processed on device: Yes. The file is read by your browser and never uploaded. There is no server to send it to.
- Formats: JavaScript regular expressions, the flavour your browser and Node run. All six flags, capture groups, named groups, and $1, $<name> and $& in a replacement.
- Limits: The first 5,000 matches are shown, and a pattern that has not finished in two seconds is stopped. Other flavours differ: PCRE lookbehind, Python's named group syntax and .NET balancing groups are not JavaScript and will not compile here.
- Mobile: Yes, on any modern mobile browser. Large files are limited by the memory the phone gives the browser.
- Offline: Yes, once the page has loaded. The tool keeps working with no network connection.

## Questions

### Why did my pattern get stopped?

It was still running after two seconds. Nested repetition is the usual cause: (a+)+, (a|a)* and (\s*,)* make the engine try every possible way of splitting the text, and the number of ways doubles with each extra character. Making the inner part more specific, so only one split is possible, fixes it and is worth doing before the pattern reaches production.

### Which flavour of regex is this?

JavaScript, exactly as your own browser implements it, because the pattern is compiled by the same engine your code will use. That means lookbehind works in current browsers, named groups are (?<name>...), and there is no /x verbose mode. A pattern copied from Python, PHP or .NET may need changing.

### What is the g flag actually doing?

Making the search continue past the first match. Without it a pattern finds one match and stops, which is what you want for validating a whole string and not what you want for finding every email in a document. It is on by default here because a tester with it off looks broken.

### Is my text sent anywhere?

No. The pattern and the text stay in this tab, and the worker that runs them is created from a blob in the page rather than fetched. People test regexes against log lines and customer records, which is exactly the sort of text that should not be pasted into somebody else's server.

## Related tools

- [JSON Formatter and Validator](https://filetity.com/json-formatter): Format, beautify, validate and read JSON, and find the line that broke it.
- [Word and Character Counter](https://filetity.com/character-counter): Count characters and words live, against the limits you are writing for.
- [CSV to JSON](https://filetity.com/csv-to-json): Turn a CSV or TSV file into JSON, as an array of objects or as rows.
