Regex Tester

//
My phone number is 123-456-7890 and zip code is 10001.
Matches: 0

What is Regex Tester?

Regex (regular expression) tester with real-time match highlighting and capture group display. Supports JavaScript regex syntax including groups `()`, non-capturing groups `(?:)`, lookahead `(?=)`, lookbehind `(?<=)`, quantifiers `*+?{}`, character classes `[]`, and more. Built-in presets: email validation, phone numbers, URLs, IP addresses, date formats. Ideal for frontend dev, data cleaning, and log analysis. All matching runs locally in your browser.

Use Cases

  • Form input validation (email, phone, ID numbers)
  • Log file pattern matching and extraction
  • Batch text replacement (e.g., stripping HTML tags)
  • Data cleaning (extracting structured info)
  • Learning regex syntax interactively

How to Use

  1. 1Enter your pattern in the Regex box (e.g., `\d+`)
  2. 2Paste test text in the Test String box
  3. 3See matches highlighted in real time
  4. 4Pick a preset template to start fast

Features

  • Real-time matching
  • Match highlighting
  • Common presets
  • Capture group display
  • Flag support (g/i/m/s)

FAQ

What is a regular expression?

A regex is a pattern description using special characters. For example, `\d+` matches one or more digits, `[a-z]+` matches lowercase letter sequences. Used widely for search, validation, and replacement.

What regex syntax is supported?

JavaScript regex syntax (ECMAScript): character classes `[]`, quantifiers `*+?{n,m}`, groups `()`, assertions `^$\b`, lookahead/lookbehind `(?=)(?<=)`. PCRE-specific features like recursive matching are not supported.

What do the g, i, m, s flags do?

g = global (find all matches); i = case-insensitive; m = multiline (^$ match each line); s = dotAll (. matches newlines).

Is \d the same as [0-9]?

In JavaScript, yes — `\d` is equivalent to `[0-9]`, matching only ASCII digits. In some engines (Python, Java), `\d` also matches Unicode digits, but JS does not.

Is my text uploaded anywhere?

No. All regex matching runs locally in your browser. Nothing is sent to a server.

Why is my regex not matching what I expect?

Common causes: (1) Missing `g` flag — only first match found; (2) Unescaped special chars — `.` should be `\.`; (3) Greedy vs lazy quantifiers — `.*` vs `.*?`.