Dev tools

Regex tester + explainer

Test a regex against sample text (matches, capture groups) and get a best-effort, segment-by-segment plain-English explanation. This is a tokenizer, not a full regex-AST parser, so complex nested/lookaround patterns get a generic per-token description. Runs on your device.

Runs on your device. The file is never uploaded.

Regex tester + explainer compiles a pattern with JavaScript's RegExp, lists every match with its index and groups, then glosses the pattern token by token. Flags default to gi, and g is added for the match pass if you omit it. The gloss is per token, so nesting and lookaround get a generic line, not a structural one.

Options

Questions

Which regex flavor is this?

JavaScript. The pattern is compiled with the built-in RegExp constructor, so whatever works here works in JS and in anything close to it. Perl, PCRE and Python features that JavaScript lacks will not compile, and the failure is reported as "invalid pattern/flags:" followed by the message the engine gave.

How do I write the pattern?

Without the surrounding slashes. The body goes in the pattern field and the flags in their own field, which defaults to gi. Backslashes are typed once, exactly as you would write them inside slashes. The output echoes the compiled form back as /pattern/flags, so you can see what was built.

Does it show all matches or only the first?

All of them. The match pass adds the g flag when your flags do not already include it, so you always get the full set. Each line shows the matched text and the index it started at, with any capture groups printed after it as a JSON array. With nothing to show it prints "(no matches)".

How good is the explanation?

It is a per-token gloss, not a structural parse. The pattern is split into tokens and each gets a line, so \d becomes a digit and + becomes 1 or more greedy. Nesting is not shown, and lookaround, named groups and unicode property escapes get a generic description. It helps you read a pattern, not verify one.

Can I test a large file with it?

The test text is a field on the page rather than a file upload, so it suits a paragraph or a sample more than a log file. There is also no timeout in the tool, so a pattern that backtracks badly on long input will keep the worker busy instead of being cut off. Be careful with nested quantifiers.

Does my test text leave the page?

No. The pattern is compiled and run in a Web Worker in this tab, with no request of any kind, so you can paste real log lines or sample records to test against. Nothing is stored between runs either; reloading the page clears everything.

Related Dev tools