Regex Tester
Your data never leaves your browserTest regular expressions with real-time match highlighting. See capture groups, named groups, and match positions.
Share this tool
Found it useful? Help a fellow developer discover it.
Test regular expressions with real-time match highlighting. See capture groups, named groups, and match positions.
Share this tool
Found it useful? Help a fellow developer discover it.
| Flag | Name | Effect |
|---|---|---|
| g | Global | Find all matches in the string, not just the first one. Without this flag, only the first match is returned. |
| i | Case-insensitive | Make the pattern match regardless of letter case. /hello/i matches "Hello", "HELLO", "hElLo". |
| m | Multiline | ^ and $ match the start and end of each line (not just the whole string). Essential when testing multi-line input. |
| s | Dot-all | Makes . match any character including newlines (\n). Without this flag, . only matches non-newline characters. |
| u | Unicode | Enable full Unicode matching. Required for patterns that use Unicode property escapes (\p{...}) or match astral plane characters (emoji, etc.). |
Email address
/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/gMatches common email addresses. Not RFC 5321 compliant but covers 99% of real-world emails.
IPv4 address
/\b(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/gMatches valid IPv4 addresses (0.0.0.0 – 255.255.255.255).
UUID v4
/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/giMatches UUID v4 strings in standard hyphenated format.
ISO 8601 date
/\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])/gMatches dates in YYYY-MM-DD format (e.g. 2024-01-15).
Hex color
/#(?:[0-9a-fA-F]{3}){1,2}\b/gMatches 3 or 6-digit hex color codes (#fff or #ffffff).
JWT token
/[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*/gMatches JWT tokens (three Base64URL segments separated by dots).
Type your pattern in the /pattern/ field and paste your test string in the editor below it. Matches are highlighted in real time as you type. Toggle flags (g, i, m, s, u) using the letter buttons next to the pattern field. The Matches list shows each match value, position, length, and all capture groups.
Regex (regular expressions) is a powerful pattern language for matching text based on characters, classes, quantifiers, and anchors. Glob patterns (used in file systems and shell commands) are simpler, using only * (any characters), ? (one character), and [...] (character sets). A regex like ^src/.*\.tsx$ is the glob equivalent of src/**/*.tsx. Globs cannot express groups, alternation, or lookaheads.
.* is greedy, meaning it matches as many characters as possible. Use .*? for a non-greedy (lazy) match, which stops at the first opportunity. For example, <.*> matches the whole string "<b>text</b>", while <.*?> matches only "<b>".
Without the m flag, ^ matches the very start of the string and $ matches the very end. With the m flag, ^ matches the start of each line and $ matches the end of each line. This is essential when you want to match patterns at line boundaries in multi-line text.
Use (?<name>...) syntax. For example, (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) captures the parts of a date as named groups year, month, and day. This tool shows named group values in the match list alongside numbered groups.
Patterns like (a+)+ on long strings can cause exponential time complexity as the regex engine tries every possible way to match. Avoid nested quantifiers on overlapping character classes. If your test string is large and the page becomes unresponsive, this is the likely cause. This tester has a 10,000-match safety limit to prevent hangs.
Yes. It uses JavaScript's built-in RegExp engine running in your browser. Syntax and behavior may differ from PCRE (PHP, Python), POSIX (grep), or .NET regex. Most common patterns are compatible, but features like variable-length lookbehind assertions (supported in Python but not all JS engines) may behave differently.
Use word boundary anchors: \b before and after the word. For example, \bcat\b matches "cat" in "the cat sat" but not in "caterpillar" or "concatenate". Without the anchors, cat would match the substring in all three. Add the g flag to find all occurrences in a string.
Text / Code Diff
Compare two text blocks and highlight line-by-line differences.
URL Encoder / Decoder
Encode or decode URL components and query strings.
Case Converter
Convert text to camelCase, PascalCase, snake_case, SCREAMING_SNAKE, kebab-case, Title Case, and 3 more formats. All 9 at once.
HTTP Status Codes
Complete HTTP status code reference with descriptions. Search and filter all 1xx, 2xx, 3xx, 4xx, and 5xx codes.