Regex Tester & Debugger

Free online regex tester to match, replace, and debug regular expressions with real-time highlighting and capture group support.

Regex literal:/(\w+)@(\w+\.\w+)/gi

2 matches found

Match 1:"[email protected]"at index 14
Group 1: "hello"
Group 2: "example.com"
Match 2:"[email protected]"at index 35
Group 1: "support"
Group 2: "test.org"

What Is a Regex Tester?

A regex tester is a tool that lets you write and evaluate regular expressions against sample text in real time. Regular expressions (regex) are powerful pattern-matching sequences used in virtually every programming language to search, validate, and transform strings. This tool provides instant feedback on matches, displays capture groups, and supports find-and-replace operations—all directly in your browser with no server-side processing.

How to Use the Regex Tester

  1. Enter your regular expression pattern in the 'Regex Pattern' field.
  2. Toggle the flags you need: Global (g), Case Insensitive (i), Multiline (m), or Dotall (s).
  3. Paste or type the text you want to test against in the 'Test String' area.
  4. Switch to the 'Match' tab to see all matches and their capture groups with index positions.
  5. Switch to the 'Replace' tab, enter a replacement pattern (supports $1, $2 backreferences), and view the result instantly.

Common Use Cases

  • Form Input Validation — Build and test regex patterns for validating emails, phone numbers, postal codes, and other user input before deploying to production.
  • Log Parsing & Data Extraction — Craft expressions to extract timestamps, IP addresses, error codes, or specific fields from server logs and structured text.
  • Search & Replace in Code — Prototype complex find-and-replace operations with capture group backreferences before running them in your IDE or build scripts.
  • Learning Regular Expressions — Experiment with regex syntax interactively—see matches and groups update in real time as you modify the pattern or test string.

FAQ

What regex flags are supported?
The tool supports four flags: Global (g) to find all matches, Case Insensitive (i) to ignore letter casing, Multiline (m) to make ^ and $ match line boundaries, and Dotall (s) to make . match newline characters.
How do capture groups work in the replace tab?
Capture groups are portions of the pattern enclosed in parentheses. In the replacement string you can reference them with $1, $2, etc., corresponding to the first, second, and subsequent groups. The tool shows each group's value in the match results.
Is my data sent to a server?
No. All regex matching and replacement runs entirely in your browser using JavaScript's built-in RegExp engine. Your text never leaves your device.
Can I test regex for other languages like Python or Java?
This tool uses JavaScript's regex engine. While most basic patterns are cross-compatible, some advanced features (like lookbehind in older JS engines, or possessive quantifiers in Java) may behave differently. Always verify in your target language.

관련 도구