My tools

REGEX TESTER / LIVE · EXPLAIN · CODE

Regex Tester

Enter representative text, a pattern and flags, inspect matches and offsets, and include empty, boundary and nonmatching examples.

Runs locally · text is not uploaded
Match Details

Unit tests

One string per line. Saved with the share link, so you see at once if a change breaks a case.

Explanation

Flavour compatibility

Checks whether the syntax in your pattern works as-is in JavaScript, PHP, Python, Java, C# and Go.

Common patterns

Code

Cheat sheet (click to insert)

characters

  • Any character except newline
  • Number
  • Word character
  • Whitespace
  • Not a digit
  • Not a word character
  • Not whitespace
  • a, b or c
  • Not a, b or c
  • a to z
  • Any letter (needs u)
  • Chinese characters

Location

  • Start
  • End
  • Word boundary
  • Not a word boundary

Quantity

  • 0 or more
  • 1 or more
  • 0 or 1
  • Exactly 3
  • 2 or more
  • 2 to 5
  • Lazy: as few as possible

Groups and references

  • Capture Group
  • Non-capturing group
  • Named capture group
  • Back-reference to group 1
  • Back-reference by name
  • a or b

Lookarounds

  • Followed by abc
  • Not followed by abc
  • Preceded by abc
  • Not preceded by abc

Escapes

  • A literal dot
  • A literal slash
  • Newline
  • Tab
  • Unicode character

Replacement syntax

  • $1 $2Groups 1 and 2
  • $<name>Named group
  • $&The whole match
  • $`Text before the match
  • $'Text after the match
  • $$A literal $

YOUR NEXT STEP

Connect useful tools with your company workflow

Create a company account to configure website monitoring, business email and notifications, and invite your team to work together.

New companies receive a 7-day Pro trial, with no card required. Trials exclude the paid monthly credit grant.

Already have an account? Open your workspace →

How to use it

  1. Type the pattern and switch on the flags you need (usually g and i).
  2. Paste text; matches highlight live and the table lists each position and group.
  3. Switch to Replace to rewrite text or Extract list to collect matches, then copy the code for your language.

Frequently asked questions

Why is only the first match found?

Without the g (global) flag JavaScript returns only the first match. Turn on "g Global" above to find them all.

How do I use groups in a replacement?

Use $1, $2 for numbered groups, $ followed by the group name in angle brackets for named groups; the cheat sheet lists the rest. To turn 2026-10-18 into 18/10/2026, use (\d{4})-(\d{2})-(\d{2}) and replace with $3/$2/$1.

Which regex flavour is this?

Your browser's JavaScript (ECMAScript 2024) syntax, with named groups, lookarounds and Unicode properties \p{…}. Most of it is the same in Python, PHP (PCRE), Java and C#; Go lacks lookarounds and back-references. The Code panel rewrites named groups and similar differences per language.

Is my text uploaded?

No. Matching runs in a separate thread in your browser and stops after 1 second to guard against catastrophic backtracking; nothing is sent to a server.

How do I write a regex for a phone number or an email address?

Common JavaScript patterns: a mainland China mobile number ^1[3-9]\d{9}$ (11 digits, second digit 3–9); a lenient email check ^[^\s@]+@[^\s@]+\.[^\s@]+$ (has @ and a dot, no spaces); Chinese characters [\u4e00-\u9fa5]; a 6-digit postcode ^\d{6}$. Keep form validation lenient — a regex cannot prove an address or number actually exists. This tool includes 18 common patterns; paste test text to see the matches and a step-by-step explanation.

regular expression tester practical guide and common questions

What does a regular expression tester do?

Regular expressions describe character patterns for matching, grouped extraction and replacement of identifiable text fragments.

Who is this for, and when is it useful?

Developers and content teams refining extraction or text-cleaning rules.

How do I use this regular expression tester?

Enter representative text, a pattern and flags, inspect matches and offsets, and include empty, boundary and nonmatching examples.

How should I interpret the results?

Test representative boundaries and replacement groups, and inspect flags such as g and i. JavaScript syntax differs from some other engines; simplify patterns stopped by the time limit.

Where is the work performed, and which services receive data?

JavaScript regular expressions run in an isolated browser Worker with a time limit. Input scripts are not executed and embedded URLs are not requested.