Regex Tester
Test regular expressions against text with live match highlighting, group extraction, and flag support.
Matches
Groups
Status
Matches
How It Works
Enter your regex pattern in the pattern field and your test string in the text area. All matches are highlighted in real time as you type. Switch on flags (global, ignore case, multiline) using the checkboxes.
Regular expressions (regex) are powerful patterns used to match, search, and manipulate text. Our free regex tester provides live match highlighting, group extraction, and support for all JavaScript regex flags.
**What is a Regular Expression?**
A regular expression is a sequence of characters that defines a search pattern. They are used in almost every programming language for validating input, parsing text, search-and-replace operations, and extracting data from strings.
**Regex Fundamentals**
- `.` matches any character except newline
- `*` matches 0 or more of the preceding element
- `+` matches 1 or more
- `?` makes the preceding element optional
- `^` anchors to the start of a line
- `$` anchors to the end of a line
- `\d` matches any digit (0-9)
- `\w` matches word characters (letters, digits, underscore)
- `\s` matches whitespace
- `[abc]` matches any of a, b, or c
- `(group)` creates a capture group
**Regex Flags**
- `g` (global): find all matches, not just the first
- `i` (ignore case): case-insensitive matching
- `m` (multiline): ^ and $ match line boundaries, not just string start/end
- `s` (dotAll): make `.` match newlines too
- `u` (unicode): enable Unicode matching
**Common Regex Patterns**
- Email: `/^[^\s@]+@[^\s@]+\.[^\s@]+$/`
- Phone (US): `/^\+?1?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/`
- URL: `/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}/`
- IP Address: `/^(\d{1,3}\.){3}\d{1,3}$/`
**Capture Groups and Named Groups**
Parentheses `()` create capture groups. Named groups `(?<name>...)` let you reference matches by name. Our tester displays all matched groups clearly.
**Privacy**
All regex processing happens in your browser using JavaScript's built-in RegExp engine.