Regex Tester

Type a pattern and some test text to see every match highlighted, with capture groups listed below. Uses the same JavaScript regex engine as Playwright and Cypress.

//

🔒 Runs entirely in your browser. Nothing you enter is sent to a server.

Regex cheat sheet for testers

TokenMeansExample
\dAny digit\d{3} matches 416
\wLetter, digit or underscore\w+ matches user_01
\sWhitespacea\sb matches "a b"
^ $Start / end of text (or line with m)^EVT-
[abc]One of these characters[A-Z]
* + ?0+, 1+, 0 or 1 timescolou?r
{n,m}Between n and m times\d{10,15}
( )Capture group(\d{4})-(\d{2})
a|bEither a or bconfirmed|cancelled

Where regex helps in QA

Frequently asked questions

Which regex flavour does this tester use?

JavaScript (ECMAScript), the same engine used by Playwright, Cypress, Node.js and every browser. Most patterns also work in Java, Python and C#, but lookbehind and named-group syntax can differ slightly.

How do I use a regex in a Playwright assertion?

Pass a RegExp literal instead of a string, for example: await expect(page.getByTestId("booking-ref")).toHaveText(/^EVT-[A-Z0-9]{6}$/). Test the pattern here first, with the ^ and $ anchors.

Why does my pattern match only once?

Turn on the g (global) flag. Without it, JavaScript stops after the first match.