Calcubes

Regex Tester

Test regular expressions against sample text. See matches, capture groups, and replace results. Free online regex tester for developers. All processing runs in your browser.

Regex tester

Status

2 match(es)

Matches

#1 "john@example.com" at index 9
#2 "jane@test.org" at index 29

What is this?

A regex tester lets you write a regular expression (pattern) and test it against sample text. Shows matches, capture groups, and replace preview. Uses JavaScript's RegExp (ECMAScript flavor). Enter your pattern, add flags (g, i, m), and paste sample text. Matches highlight instantly. Use the replace field to preview replacements. Invalid regex syntax shows an error. Supports character classes, quantifiers, anchors, and capture groups. Common patterns: \d for digits, \w for word chars, \s for whitespace. Essential for debugging. All processing in browser. No server, no limits. Perfect for learning and testing.

When to use

Use when writing or debugging regex for validation, search/replace, or parsing. Example: Test \d{3}-\d{4} for phone numbers. Debug why your pattern doesn't match. Preview replace results. Developers validate input patterns. Test search-and-replace before running. Learn regex syntax. Debug complex patterns. Verify capture groups. Essential for anyone using regex. Paste pattern and text. See matches immediately. Fix errors before deploying. Use flags for global, case-insensitive, or multiline matching.

How to use

Enter your regex pattern and sample text. Matches are highlighted. Use flags: g (global), i (case-insensitive), m (multiline). Optionally enter a replacement string to preview the result.

Common patterns

  • \d — digit; \w — word character; \s — whitespace
  • + — one or more; * — zero or more; ? — zero or one
  • ^ — start; $ — end; [a-z] — character class

Frequently asked questions

How do I test a regex?
Enter your regular expression in the pattern field and sample text in the test string. The tool highlights all matches and shows capture groups. Use the replace field to preview replacements.
What regex flavor does this use?
This tool uses JavaScript's native RegExp (ECMAScript flavor). It supports standard features like character classes, quantifiers, anchors, and capture groups.
Why does my regex show an error?
Invalid regex syntax (e.g., unescaped special characters, unbalanced brackets) causes an error. Check that metacharacters like [, ], (, ), +, * are properly escaped when matching literally.
Can I use flags like case-insensitive?
Yes. Add flags after the pattern: g (global), i (case-insensitive), m (multiline). Example: /hello/gi matches "hello" and "HELLO" everywhere.

Related tools

View all text & formatting