How to use Regex Tester
The Regex Tester lets you write, test and debug regular expressions interactively against live sample text. It highlights all matches in real time, displays captured groups in a structured table and supports common regex flags such as global, case-insensitive, multiline and dotAll — making it an essential tool for validating patterns before embedding them in code.
- Enter your regular expression in the pattern field (without surrounding slashes).
- Select the flags you need: g (global), i (case-insensitive), m (multiline), s (dotAll).
- Type or paste your test string in the input area.
- Matches are highlighted inline and listed in the matches panel below.
- Expand any match row to inspect individual capture groups and their positions.
- Copy the working regex (with flags) to use directly in your code.
Your data never leaves your device — 100% private processing.
Understanding regex flags
Flags modify how the regex engine processes the pattern. The global flag (g) finds all matches rather than stopping at the first. The case-insensitive flag (i) makes letter comparisons ignore case. The multiline flag (m) makes ^ and $ match the start and end of each line instead of the entire string. The dotAll flag (s) makes the dot metacharacter match newline characters, which it normally excludes. Combining flags gives fine-grained control over matching behaviour.
Capture groups and named captures
Parentheses create capturing groups that extract sub-matches. For example, (d{4})-(d{2})-(d{2}) captures year, month and day from an ISO date string into groups 1, 2 and 3. Named captures (?<year>d{4}) assign a label, making patterns self-documenting. Non-capturing groups (?:...) group tokens without creating a capture, which improves performance and keeps group numbering clean.
| Token | Meaning | Example |
|---|---|---|
| . | Any character except newline | a.c → "abc", "a1c" |
| \d | Digit [0-9] | \d{3} → "123" |
| \w | Word character [A-Za-z0-9_] | \w+ → "hello_1" |
| ^ | Start of string/line | ^Hello → "Hello world" |
| $ | End of string/line | world$ → "Hello world" |
| * | Zero or more | ab* → "a", "ab", "abb" |
| + | One or more | ab+ → "ab", "abb" |
| ? | Zero or one (optional) | colou?r → "color", "colour" |
Worked examples
Find all numbers
Inputs: pattern \d+ · flag g · text "Order 66 and 99"
Result: 2 matches: "66", "99"
Named capture group
Inputs: pattern (?<year>\d{4}) · text "2025-01-01"
Result: match "2025" · groups.year = "2025"
Lazy vs greedy
Inputs: pattern <.+?> on "<a><b>"
Result: lazy gives 2 matches: "<a>", "<b>"
Glossary
- Regex
- Regular expression — a pattern that describes a set of strings using special syntax.
- Lookahead
- A zero-width assertion (?=...) that matches a position followed by a specific pattern without consuming characters.
- Lookbehind
- A zero-width assertion (?<=...) that matches a position preceded by a specific pattern.
- Quantifier
- A token such as *, +, ?, {n,m} that specifies how many times the preceding element may appear.
- Backreference
- A token \1 that matches the same text previously matched by capture group 1.
Related reading
Frequently Asked Questions
Why use Regex Tester?
- Test regex patterns against live sample text with real-time match highlighting
- Inspect all named and numbered capture groups in a structured table
- Validate flag combinations (g, i, m, s) before embedding the pattern in production code
- Step through match positions to understand exactly what each capture group contains
Common use cases
- Validate that an email pattern matches expected addresses without false positives
- Extract date components from log lines using named capture groups
- Debug a greedy quantifier that is consuming more characters than intended
- Verify a phone-number regex handles international prefixes and optional extensions
- Test a URL parser pattern against edge cases before embedding it in an API validator
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Related Developer Tools
Social Media Character Counter
Count characters for Twitter/X, Instagram, LinkedIn, Facebook, and more. Live counter with limit warnings for every major social media platform.
Social Media Fonts Generator
Convert text into stylish Unicode social fonts like bold, script, fraktur, circled, and upside down with one-click copy, fully private in your browser.
Remove Line Breaks
Remove line breaks and paragraph breaks from text online. Replace breaks with spaces, keep paragraphs, and strip extra spaces. Free and private.
Sort Text Lines
Sort lines of text alphabetically, numerically, or reverse. Case-insensitive option, remove duplicates, and trim whitespace. Free online line sorter.
Case Converter
Convert text to camelCase, PascalCase, snake_case, kebab-case, UPPERCASE, lowercase, Title Case, and Sentence case instantly.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
Explore all Developer Tools.