LOCAL TOOL · DEV

Regex Tester (JavaScript)

Type a pattern and see what it catches.

This is the browser's own JavaScript RegExp engine. Other languages, Java and Python among them, differ in places.

Flags
Try one
Matches

Pattern and text stay in this browser.

How to use

  1. Type the pattern and tick the flags you want. Matches appear as you type.
  2. The table gives the position of each match and whatever the groups caught.
  3. Put something in the replace box to see the text as it would come out.

Examples

Every number in a line

\d+ on "order 1138, seat 42, gate 7" catches 1138, 42 and 7, and the table says where each one starts.

Korean only

[가-힣]+ keeps the Korean and leaves the Latin alone. Percent-encoded text has to be decoded first — %EA%B0%80 is not a Korean character yet. URL Encoder / Decoder

Groups with names

(?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2}) names its captures, and the table shows y, m and d by name instead of by number.

A pattern that would hang the page

(a+)+$ against a long line of a characters never finishes. Here it runs in a separate thread and is cut off after a second.

FAQ

Which regex flavor is this?

Browser JavaScript (ECMAScript) RegExp; other languages differ in places.

Can a bad pattern freeze the page?

Matching runs in a worker and stops automatically after 1 second.

Is my text sent anywhere?

No. All matching runs in your browser.