Regex Tester
Enter a regular expression pattern and test string to see matches highlighted in real-time. Toggle flags and view detailed match information.
How to Use This Tool
- Step 1Write a Pattern
Enter your regular expression in the pattern field. The live /pattern/flags display updates as you type.
- Step 2Toggle Flags
Enable flags: g (global — all matches), i (case-insensitive), m (multiline), s (dotAll — . matches newlines).
- Step 3Enter Test String
Paste or type your test string. Matches highlight instantly in the preview below with colored markers.
- Step 4Inspect Match Details
View each match with its index position and named capture groups. Hover highlighted text for match numbers.
- •Use named groups like (?<year>\d{4}) to label captures — they appear in the match details section.
- •The global flag (g) finds ALL matches. Without it, only the first match is returned.
- •Invalid patterns show a red error immediately — fix syntax before checking matches.
- •Common patterns: \d+ (digits), \w+ (word chars), [a-zA-Z] (letters), ^...$ (full string match).
Regular Expressions Reference
Regular expressions (regex) are patterns used to match character combinations in strings. They are essential for text processing, validation, search, and data extraction.
Common patterns: \d+ matches digits, \w+ matches word characters, [a-zA-Z] matches letters, ^...$ anchors to start/end.
Flags: g (global — all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), s (dotAll — . matches newlines).
Regex is tested in nearly every technical interview. Practice building patterns for email validation, URL parsing, log extraction, and input sanitization.