Free 100% In-Browser Tool

Regex Tester: Test Regular Expressions Online

Test and debug regular expressions in real time with match count, captured group inspection, and string replacement.

Quick Answer:Enter your regex pattern between slashes and type your test text to see matching substrings and captured groups highlighted instantly.
Initializing tool...

Privacy First: 100% Client-Side Processing

Processed in your browser. Files are never uploaded.

How to Use the Regex Tester & Debugger (JavaScript RegEx)

  1. 1Enter your regular expression pattern into the pattern input.
  2. 2Select or customize regex flags (e.g., 'g' for global match, 'i' for case-insensitive).
  3. 3Type or paste your sample test text into the test box.
  4. 4Review the total match count, indices, and captured group values.
  5. 5Optionally enter replacement text to test string substitutions.

Formula & How It Works

ECMAScript RegExp Engine

new RegExp(pattern, flags).exec(testString)

Executes standard JavaScript RegExp engine matches with safe loop termination on zero-length matches.

Worked Examples

Extracting Email Addresses

Input: Pattern: ([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})

Explanation: Extracts email usernames into Group 1 and domain names into Group 2.

Result: Matches: support@toolzy.app, sales@example.com

Finding Phone Numbers

Input: Pattern: \b\d{3}[-.]?\d{3}[-.]?\d{4}\b

Explanation: Matches formats like 555-123-4567 and 5551234567.

Result: Matches standard 10-digit US phone numbers

Case-Insensitive Global Word Match

Input: Pattern: \bcat\b, Flags: gi

Explanation: Word boundary \b ensures 'scatter' is not matched.

Result: Matches 'cat', 'Cat', 'CAT'

Frequently Asked Questions

What does the 'g' flag do in regex?▼

The 'g' (global) flag tells the regular expression engine to find all matches across the entire string rather than stopping at the first match.

What does the 'i' flag do?▼

The 'i' (ignore case) flag makes matches case-insensitive, treating uppercase and lowercase letters as identical.

How do you match a literal period (.)?▼

Because a period is a wildcard matching any character, you must escape it with a backslash: \.

Does this tester support captured groups?▼

Yes, all parenthesized capture groups ($1, $2, etc.) and named groups are listed with exact match indices.

Is this tool secure?▼

Yes, all regular expression evaluations run in your browser sandbox with loop-protection against catastrophic backtracking.

Quick Reference & Conversion Table

Meta-characterMeaningExampleMatches
\dAny digit (0-9)\d{3}123
\wAny word character (a-z, A-Z, 0-9, _)\w+User_12
\sAny whitespace (space, tab, newline)\s+Spaces
[abc]Any character inside brackets[aeiou]Any vowel
^ / $Start / End of string^StartLines starting with Start

⚠️ Common Pitfalls to Avoid

  • •Forgetting the global flag 'g' (without 'g', the regex stops evaluating after finding the very first match).
  • •Failing to escape special regex meta-characters like ., *, +, ?, [, ], (, ), and $ with backslashes.
  • •Writing greedy quantifiers that match too much text (use non-greedy *? or +? when matching between tags).

💡 Practical Real-World Uses

  • •Validating user input forms (emails, URLs, phone numbers, passwords).
  • •Log file parsing, security audit filtering, and web scraping.
  • •Search-and-replace text batch processing in code editors.

Greedy vs Lazy (Non-Greedy) Matching

  • ✓Greedy matchers (*, +) match as much text as possible before stopping.
  • ✓Lazy matchers (*?, +?) match as little text as possible, stopping at the very first valid boundary.
Last reviewed & updated: 2026-11-01
Free & Open Access
Related Utilities

Explore complementary calculators and converters with instant client-side execution

More in Text & Dev

Explore Other Tool Categories

Browse our full collection of 50 free web utilities

View All 8 Categories