← Back to FreeTextUtils ·

A regex tester lets you validate regular expressions against test strings in real time, showing matches, groups, and errors instantly. Whether you are a developer debugging a pattern, a data analyst validating extraction rules, or a QA engineer testing input validation, this free online regex tester gives you immediate feedback. No signup required. Try it now.

Try the Free Regex Tester

Enter a regex pattern, optional flags, and a test string to see matches and capture groups instantly.

Enter a pattern and test string, then click Test

How It Works

Step 1: Enter your regex pattern

Type your regular expression pattern in the pattern field. Use standard JavaScript regex syntax including character classes, quantifiers, groups, and anchors.

Step 2: Set flags (optional)

Enter flags like g for global matching, i for case-insensitive, or m for multiline mode. The default is gi for case-insensitive global matching.

Step 3: Paste your test string

Enter the text you want to match against your pattern. The tool shows all matches with their positions and any capture groups.

How to Use the Regex Tester — Step by Step

Step 1: Write or paste your pattern

Enter a regular expression in the pattern field. Use JavaScript regex syntax: \d for digits, \w for word chars, . for any char, *, +, ? for quantifiers, () for groups.

Step 2: Choose your flags

Add flags: g (global - find all matches), i (case-insensitive), m (multiline - ^/$ match line breaks), s (dotall - . matches newlines). Default: gi.

Step 3: Provide test input

Paste the text you want to search. The tool highlights all matches, shows their positions, and extracts capture group contents.

Step 4: Debug and refine

If the pattern is invalid, the tool shows the error. Adjust the pattern and test again until matches are correct. The error message helps you pinpoint syntax issues.

Common Use Cases

Examples

Pattern: [\w.-]+@[\w.-]+\.\w+ | Flags: gi
Input: "Contact [email protected] or [email protected] for help"
Output: 2 matches: "[email protected]" (index 8), "[email protected]" (index 33)

Pattern: (\d{3})-(\d{4}) | Flags: g
Input: "Call 555-1234 or 555-5678 today"
Output: 2 matches: "555-1234" (Group 1: 555, Group 2: 1234), "555-5678" (Group 1: 555, Group 2: 5678)

Pattern: (\d{4}-\d{2}-\d{2})\s+(\w+)\s+(ERROR|WARN) | Flags: g
Input: "2024-01-15 10:00:00 Auth ERROR\n2024-01-15 10:00:01 DB WARN"
Output: 2 matches with 3 capture groups each (date, component, level)

Pattern: (?\$\d+(?:,\d{3})*(?:\.\d{2})?) | Flags: g
Input: "Prices: $19.99, $1,299.00, $50"
Output: 3 matches with named capture group "currency" extracting each price

Tips & Best Practices

FAQ — Frequently Asked Questions

Q: What is a regular expression?

A: A regular expression (regex) is a pattern used to match character combinations in strings. It's a powerful tool for text search, validation, and manipulation.

Q: What flags can I use?

A: Common flags: g (global — find all matches), i (case-insensitive), m (multiline), s (dotall). Enter them in the flags input field.

Q: What regex flavor does this use?

A: This tool uses JavaScript's native RegExp engine (ECMAScript regex flavor). It supports character classes, quantifiers, groups, lookaheads, and all standard JS regex features.

Q: Can I test replacement patterns?

A: This tool shows matches and capture groups. For find-and-replace testing, use the Regex Find/Replace tool which supports replacement patterns with $1, $2, etc.

Q: Is the tool secure?

A: Yes. All processing happens in your browser. We never see, store, or save your text or patterns.