Tech & Dev

Regex Tester

Test and debug regular expressions

Calculator

//

How to Use

Test and debug regular expressions

1

Enter pattern

Input your regex pattern

2

Enter test string

Input text to match against

3

Set flags

Choose global, case insensitive, etc.

4

View matches

See all matches highlighted

Frequently Asked Questions

Regex is a pattern language for matching text. Used for validation (email format), search/replace, data extraction. Basic patterns: . (any char), * (0+ of previous), + (1+), ? (0-1), [abc] (any of a,b,c), \d (digit), \w (word char).

Simple email: [\w.-]+@[\w.-]+\.[a-zA-Z]{2,}. This matches word characters, dots, hyphens before @, then domain. Note: perfect email validation is extremely complex - this catches most valid formats.

Parentheses create capture groups to extract parts of matches. Pattern (\d{3})-(\d{4}) on "555-1234" captures ["555", "1234"]. Use $1, $2 in replacements to reference captured groups.

Common issues: not escaping special characters (\. for literal dot), forgetting anchors (^ start, $ end), greedy vs lazy matching (.* vs .*?), flag differences (case insensitive, multiline). Test incrementally!