{ Regex Tester }

// test regex live in the browser

Test and debug regular expressions live in the browser. Highlight matches, capture groups, flags, and see results instantly. Free, no sign-up required.

/ /
Ready
๐Ÿ”

Match results appear here

Enter a pattern and test string to see matches
QUICK REF:

HOW TO USE

  1. 01
    Enter Pattern

    Type your regex in the pattern field between the slashes. Toggle flags as needed.

  2. 02
    Paste Test String

    Paste or type the string you want to test your regex against in the left panel.

  3. 03
    See Live Results

    Matches highlight in real time. View detailed match data and capture groups on the right.

FEATURES

Live Highlighting Capture Groups All 6 Flags Match Index Quick Patterns No Backend

USE CASES

  • ๐Ÿ”ง Validate form inputs (email, phone, URL)
  • ๐Ÿ”ง Extract data from logs and text files
  • ๐Ÿ”ง Debug complex regex patterns interactively
  • ๐Ÿ”ง Learn regex syntax with instant feedback
  • ๐Ÿ”ง Build search/replace patterns for editors

WHAT IS THIS?

A Regex Tester is an interactive tool that lets you write and test regular expressions against sample text in real time. It highlights matches, extracts capture groups, and shows match positions โ€” all in the browser without any server calls.

This tool uses the JavaScript RegExp engine, making it ideal for frontend and Node.js developers.

RELATED TOOLS

FREQUENTLY ASKED QUESTIONS

What regex engine does this tool use?

This tool uses JavaScript's built-in RegExp engine, which runs entirely in your browser. It supports ECMAScript regex syntax including lookaheads, lookbehinds (ES2018+), named groups, and Unicode property escapes with the u flag.

What do the flag buttons do?

g (global) finds all matches, not just the first. i makes matching case-insensitive. m makes ^ and $ match line boundaries. s (dotAll) makes . match newlines. u enables full Unicode support. y (sticky) matches only from the last index position.

What are capture groups and how do they appear?

Capture groups are portions of a pattern wrapped in parentheses (...). They extract specific sub-matches from the full match. In this tool, each match card shows the full match plus any numbered or named capture groups beneath it.

Why do I see no matches even though my pattern looks correct?

Common causes: the i flag is off and case doesn't match; the g flag is off so only the first match is found; special characters like ., *, + need escaping with \ when you mean them literally; or anchors ^ and $ require the m flag for multiline text.

Is my data sent to a server?

No. All regex matching happens entirely in your browser using JavaScript. Your pattern and test string never leave your device. This makes the tool fast, private, and usable offline.

How do I match a literal dot or special character?

Escape it with a backslash: \. matches a literal period, \* matches a literal asterisk, \( and \) match literal parentheses. The special characters that need escaping are: . * + ? ^ $ { } [ ] | ( ) \

What is the difference between \d, \w, and \s?

\d matches any digit 0โ€“9. \w matches any word character: letters, digits, and underscore. \s matches any whitespace: space, tab, newline, etc. Their uppercase versions (\D, \W, \S) match the opposite โ€” everything that the lowercase version does NOT match.

Can I use named capture groups?

Yes. Use the syntax (?<name>...) to create a named group. For example, (?<year>\d{4})-(?<month>\d{2}) creates named groups year and month. Named groups appear labelled in the match results panel.

What Is a Regex Tester?

A regex tester โ€” short for regular expression tester โ€” is an interactive tool that lets you write, test, and debug regular expressions against sample text in real time. Instead of writing code, running it, and checking output manually, a regex tester gives you an immediate visual loop: type your pattern, see the matches highlighted instantly, inspect capture groups, and adjust until it's right.

This particular tool runs entirely in your browser using JavaScript's native RegExp engine. There's no server, no install, and no account needed โ€” just open the page and start testing.

How Regular Expressions Work

A regular expression is a sequence of characters that defines a search pattern. The pattern is matched against a target string, and the engine returns zero or more matches. Each match can contain the full matched text plus any sub-matches captured by parentheses (called capture groups).

Regex syntax is powerful but compact. A small pattern like \b[A-Z][a-z]+\b matches any word that starts with a capital letter followed by one or more lowercase letters โ€” useful for finding proper nouns. A pattern like \d{4}-\d{2}-\d{2} matches dates in ISO 8601 format (YYYY-MM-DD).

Regex Flags Explained

Flags modify how a pattern is applied to text. The JavaScript regex engine supports six flags:

Understanding Capture Groups

Capture groups let you extract specific parts of a match. Any portion of a pattern wrapped in parentheses (...) is a capturing group. For example, the pattern (\d{4})-(\d{2})-(\d{2}) on the string "2024-03-15" would yield the full match "2024-03-15" plus three capture groups: "2024", "03", and "15".

You can also use named capture groups with the syntax (?<name>...). Named groups make your regex more readable and self-documenting. The pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) produces the same matches but labels them as year, month, and day.

Non-capturing groups use (?:...). They group parts of a pattern without creating a capture, which is useful for applying quantifiers to a group without extracting the text.

Common Regex Patterns and What They Match

Regex Quantifiers

Quantifiers control how many times a part of a pattern can match:

By default, quantifiers are greedy โ€” they match as much text as possible. Adding ? after a quantifier makes it lazy, matching as little as possible. For example, <.+> on <b>bold</b> matches the whole string, while <.+?> matches just <b>.

Anchors and Boundaries

Anchors match positions in the string rather than characters. ^ matches the start of the string (or line with the m flag), and $ matches the end. \b matches a word boundary โ€” the position between a word character and a non-word character. Word boundaries are extremely useful for finding whole words: \bcat\b matches "cat" in "the cat sat" but not in "concatenate".

Why Use This Online Regex Tester?

Debugging regular expressions in production code is slow and frustrating. Every change requires re-running your code, checking output, and iterating. An online regex tester collapses that loop to near-zero: change a character, see the result instantly. This makes learning regex dramatically faster, and it makes debugging complex patterns far less painful.

Because this tool uses the same JavaScript RegExp engine as browsers and Node.js, patterns tested here will behave identically in your JavaScript code. No translation or syntax differences to worry about.

Tips for Writing Better Regular Expressions

โ˜•