🔎

Regex Tester

Test and debug regular expressions with live match highlighting

//g
Matches:4
hello world foo bar

Capture Groups

Match 1hellogroup 1: hello
Match 2worldgroup 1: world
Match 3foogroup 1: foo
Match 4bargroup 1: bar

About This Calculator

Regular expressions (regex) are patterns used to match, search, and manipulate strings in programming. This tester provides a real-time environment to write, test, and debug JavaScript regex patterns against sample text. It highlights all matches directly in your test string, displays capture group contents, and lets you toggle regex flags including global (g), case-insensitive (i), and multiline (m). As you type your pattern and test text, matches update live so you can iterate quickly. Regex is essential for form validation, log parsing, data extraction, search-and-replace operations, and text processing. This tool uses JavaScript regex syntax, so your patterns will behave exactly as they would in a JavaScript application.

How to Use

  1. 1
    Enter a regex pattern
    Type your JavaScript regular expression and toggle flags (global, case-insensitive, multiline).
  2. 2
    Provide test text
    Enter sample text to match against your pattern.
  3. 3
    Review matches
    See highlighted matches and capture group contents in real time.

Frequently Asked Questions

Q. What regex flavor does this tool use?
This tool uses JavaScript regular expressions. Patterns behave exactly as they would in a JavaScript application with methods like String.match() or RegExp.exec(). If you need to test patterns for Python, Go, or other languages, be aware that syntax may differ for features like lookbehinds and named groups.
Q. How do capture groups work in regex?
Parentheses () create capture groups that save the matched text for later use. In a pattern like (\d{3})-(\d{4}), group 1 captures the first three digits and group 2 captures the last four. This tool displays the contents of each capture group alongside the full match.
Q. What are the available regex flags?
You can toggle three flags: g (global) to find all matches instead of stopping at the first, i (case-insensitive) to ignore letter case, and m (multiline) to make ^ and $ match the start and end of each line rather than the entire string.

Disclaimer: Results are for informational purposes only and do not constitute professional advice. Always consult qualified professionals for important decisions.