←
Regex TesterJavaScript regular expressions
Flags
Try an example
49 characters
Matches highlighted
Mail ann@example.com or ben@site.com for details.

Match details

No matches.

More info

How to use it

Type a pattern between the slashes, paste some text, and every match is highlighted. Below, each match is listed with where it starts and what each group (the parts in round brackets) captured; named groups like (?<year>\d+) show by name. Use the flag buttons to change how the pattern behaves, or tick Preview a replacement to see the text after a find-and-replace, with $1 standing for group 1.

Quick reference

. any character · \d a digit · \w a letter, digit or _ · \s a space · \b a word edge · [abc] one of a, b, c · [^abc] anything else · a|b a or b · ^ and $ start and end · * zero or more · + one or more · ? optional · {2,4} two to four · (…) a group · (?:…) a group that isn’t captured · (?=…) must be followed by.

Questions

Which regex flavour is this? JavaScript’s, the one built into your browser. Python, PHP and others are close but differ in details such as lookbehind and named group syntax.

Why does it say the pattern took too long? Some patterns, like (a+)+$, can take exponentially longer as the text grows. The test runs in a background worker that is stopped after about a second and a half, so the page never freezes.

Is my text sent anywhere? No. Matching happens in your browser. Only your pattern and flags are remembered here; the text you test is not saved.