Regex Tester

Test a regex against your text, with live highlights and a replace preview.

Options
Matches

Examples

Common patterns

Questions

Can I use this pattern in Python or Go?

Open "Use it in code" under the tool for a snippet in JavaScript, Python or Go. It converts syntax that differs, such as named groups and replacement references, and tells you when something won't work, like lookbehind in Go.

Why do I sometimes get a timeout error?

Some patterns take a very long time to fail. (a+)+b against a long string of a's with no b is a classic case, called catastrophic backtracking. Matching runs in a background thread with a time limit, so the page never freezes.

How are named groups shown?

A group written as (?<name>...) is shown with its name as well as its number. Naming a group doesn't change the numbers of the others.

Does Replace support $1 and named groups?

Yes, with the same syntax as JavaScript's String.replace(): $1, $2 for numbered groups, $<name> for named groups, $& for the whole match and $$ for a dollar sign.

Is my text or pattern sent anywhere?

No. Matching and replacing run in your browser.