Regex Tester
Patterns that take longer than 1 second are stopped automatically, so your browser never freezes.
Try a regex instantly
Regular expressions describe text patterns like “3 digits, dash, 3 digits, dash, 4 digits”. They're everywhere — code, data cleanup, spreadsheet REGEX functions, find-and-replace in editors — and one wrong character changes everything. This tool highlights matches as you type and lists positions and capture-group values in a table, so you can see at once whether the pattern does what you mean.
Flags
- g — find all matches, not just the first.
- i — ignore case.
- m — ^ and $ match at the start and end of each line.
- s — the dot (.) also matches line breaks.
- u — Unicode mode; needed for emoji and properties like \p{L}.
Replace and common patterns
Type a replacement to preview the result. $1, $2 refer to the first and second capture groups and $& to the whole match — for example, $1-***-$3 masks the middle of a phone number. Ready-made patterns for phone numbers, email, URLs, dates, ZIP codes, letters in any language, HTML tags and IP addresses can be tried from the list. They're meant for finding common formats, not for strict validation of every edge case.
This uses your browser's JavaScript regex engine. Most syntax matches Python, Java and spreadsheet regex, but some features (lookbehind, named-group syntax) can differ. Runaway patterns are stopped after 1 second so the page never hangs. Your text never leaves your device.
Frequently asked questions
Does \d match digits in other scripts?
In JavaScript, \d matches only 0–9. Use \p{Nd} with the u flag for all decimal digits.
How do I match any letter, including accented ones?
Use \p{L} with the u flag (the “Letters only” preset).
Can I use these in Excel or Google Sheets?
Mostly yes — in REGEXTEST/REGEXEXTRACT (Excel 365) or REGEXMATCH (Sheets), though a few features differ.
Related tools
- Find and Replace Text (Bulk, Regex)Replace many words at once with a list of rules — case-insensitive, whole words or regular expressions
- JSON Formatter & ValidatorPretty-print JSON, pinpoint errors, minify, sort keys, escape/unescape strings
- URL Encode & Decode (Percent-Encoding)Decode %XX sequences into readable text or percent-encode text for URLs, with a query parameter table
- Base64 Encode / DecodeText (UTF-8) ↔ Base64, files and images → data URI, Base64 → file
- Color Code ConverterConvert HEX, RGB, HSL, HSV and CMYK, check WCAG contrast, get lighter/darker shades
- Color Palette GeneratorComplementary, analogous, triadic and monochrome palettes from one color, or extract colors from a photo