Regex Tester & Debugger

Build, test, and debug regular expressions against your own text with live matching, match highlighting, capture groups, and the g, i, m, s, u, and y flags. Everything runs locally in your browser — your patterns and data are never uploaded.

Everything runs locally in your browser. Your pattern and test string are never uploaded.
Try an example:
Quick Regex Reference

Character classes

.Any character except newline
\dDigit (0–9)
\DNon-digit
\wWord char (a–z, 0–9, _)
\WNon-word char
\sWhitespace
\SNon-whitespace
[abc]Any of a, b, or c
[^abc]Not a, b, or c
[a-z]Range a to z

Quantifiers

*Zero or more
+One or more
?Zero or one (optional)
{3}Exactly 3
{2,4}Between 2 and 4
{2,}2 or more
*?Lazy: as few as possible

Anchors & boundaries

^Start of string / line
$End of string / line
\bWord boundary
\BNon-word boundary

Groups & alternation

(…)Capture group
(?:…)Non-capturing group
(?<n>…)Named group
a|ba or b (alternation)
\1Backreference to group 1
(?=…)Lookahead
(?<=…)Lookbehind

Common escapes

\.Literal dot
\/Literal slash
\\Literal backslash
\tTab
\nNewline
\rCarriage return
\uFFFFUnicode code point

Flags

gFind all matches
iCase-insensitive
m^ and $ match each line
s. matches newlines
uUnicode mode
ySticky matching

How the regex tester works

This tool tests regular expressions entirely in your browser using JavaScript's native regex engine. Nothing is sent to a server — the matching happens on your device, so it is fast, private, and works offline once the page has loaded.

Pattern & test string

Type your regular expression in the top field and paste the text you want to search below. As you type, the tester compiles the pattern and highlights every match directly in the test string, so you can see exactly what the regex captures and where.

Flags & matches

Toggle the g, i, m, s, u, and y flags to change how the pattern is applied. Each match is listed with its start and end position and the contents of every capture group, and you can copy all matches with one click.

Friendly errors

When a pattern is incomplete or invalid — an unbalanced bracket, for example — the tester shows a clear, plain-language message instead of crashing or silently failing, so you can fix the pattern as you build it.

Example patterns

The chips below the tool load ready-made patterns for emails, IP addresses, URLs, UUIDs, JWTs, and more — each with sample text — so you can see a working regex instantly and adapt it to your own data.

What is a regular expression?

A regular expression (regex or regexp) is a concise pattern that describes a set of strings. Rather than searching for one fixed word, you describe the shape of the text you want — such as “one or more digits” or “an email-like address” — and a regex engine finds every piece of text that fits. Regex powers find-and-replace in editors, input validation, log parsing, and detection rules across nearly every programming language and security tool.

Literals vs metacharacters

Most characters in a pattern match themselves — cat matches the text “cat”. Metacharacters like . * + ? ( ) [ ] { } ^ $ | have special meaning. To match one literally, escape it with a backslash, so \. matches a real dot.

Greedy vs lazy

By default quantifiers are greedy and match as much text as possible. Adding a ? after them (such as .*?) makes them lazy, matching as little as possible — handy when a greedy match swallows more than you intended.

Tip: build patterns incrementally. Start with a small piece that matches, confirm it with the live highlighting here, then add the next part. It is far easier than writing a long pattern and debugging it all at once.

Regex flags explained

Flags modify how the whole pattern is applied. This tester supports all six JavaScript flags — toggle them above to watch the matches change in real time.

  • g — global: find every match instead of stopping at the first one.
  • i — ignore case: match letters regardless of upper or lower case.
  • m — multiline: ^ and $ match the start and end of each line.
  • s — dotAll: the dot . also matches newline characters.
  • u — unicode: full Unicode handling and \u{…} escapes.
  • y — sticky: each match must begin exactly where the previous one ended.

Common uses for regular expressions

Regex shows up anywhere text needs to be searched, validated, or transformed. Here is where IT, security, and development teams reach for it most often.

  • Log parsing — pull IPs, timestamps, and error codes out of noisy log files
  • SIEM / IDS rules — write detections that match suspicious patterns
  • grep / sed / awk — power command-line search and replace
  • PowerShell-match and -replace on Windows
  • Input validation — check emails, phone numbers, and formats
  • Data extraction — scrape fields and tokens from text
  • Code refactoring — search-and-replace across a codebase
  • Routing & rules — firewall, proxy, and URL-rewrite matching

Test before you ship: a regex that looks right can quietly over- or under-match real data. Paste representative samples here first — including the edge cases you expect to reject — so you catch problems before the pattern reaches production.

Privacy: processed locally in your browser

Every match this tool performs happens entirely in your browser. The pattern and test string you enter are handled exclusively by JavaScript in your browser tab — never transmitted to a server, never logged, and never stored anywhere outside your device.

Technical verification: open your browser's developer tools (F12), select the Network tab, and type a pattern. You will see zero outgoing requests — the tool works entirely through in-memory JavaScript.

Frequently asked questions

What is a regular expression (regex)?

A regular expression, or regex, is a compact pattern that describes a set of strings. Instead of searching for one fixed word, you describe a shape — for example “one or more digits” or “an email-like address” — and the regex engine finds every piece of text that fits. Regex is used for searching, validating, extracting, and replacing text in editors, programming languages, log tools, and security platforms.

How does this regex tester work?

Type a pattern in the top field and paste your text below. As you type, the tester compiles the pattern with JavaScript's built-in regex engine and highlights every match in the test string. It shows the total match count, each match's start and end position, and the contents of any capture groups. Everything updates live and runs entirely in your browser.

What do the regex flags g, i, m, s, u, and y mean?

Flags change how a pattern is applied. g (global) finds all matches instead of stopping at the first. i (ignore case) makes matching case-insensitive. m (multiline) makes ^ and $ match at the start and end of each line. s (dotAll) lets the dot match newline characters. u (unicode) enables full Unicode handling. y (sticky) anchors each match to where the last one ended.

What are character classes in regex?

A character class matches any one character from a set. Square brackets define a custom class, such as [aeiou] for any vowel or [A-Za-z0-9] for any letter or digit. Shorthand classes cover common sets: \d matches a digit, \w a word character, and \s whitespace, with uppercase \D, \W, and \S matching the opposite. A dot . matches almost any single character.

What are quantifiers in regex?

Quantifiers say how many times the preceding token may repeat. * means zero or more, + means one or more, and ? means zero or one. Curly braces give counts: {3} is exactly three, {2,4} is two to four, and {2,} is two or more. Quantifiers are greedy by default; adding ? (such as +?) makes them lazy and match as little as possible.

What are anchors and capture groups?

Anchors match a position rather than a character: ^ is the start, $ is the end, and \b is a word boundary. Capture groups use parentheses ( ) to group part of a pattern and remember what it matched, so you can extract or reuse it. (?:…) groups without capturing, and (?<name>…) creates a named group. This tester lists every captured group for each match.

Is my data sent to a server?

No. Both the pattern and the test string are processed entirely in your browser using JavaScript's native regex engine. Nothing you type is transmitted, logged, or stored outside your own browser tab. You can verify this by opening your browser's Network tab in developer tools — you will see no outgoing requests — and the tool keeps working even with your network disconnected after load.

Which regex flavor does this tester use?

It uses the JavaScript (ECMAScript) regular expression engine built into your browser. JavaScript regex is very close to the PCRE-style syntax used by Python, Java, PHP, and other languages, so most patterns transfer directly. A few advanced features such as recursion, possessive quantifiers, and certain lookbehind edge cases differ, but everyday patterns behave the same across flavors.

How do I write an email or IP address regex?

Use the example chips above as a starting point. A practical email pattern is [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}, which matches a local part, an @, a domain, and a top-level domain of at least two letters. A common IPv4 pattern validates each octet from 0–255. Click a chip to load the pattern with sample text so you can see exactly what it matches and adapt it.

Why is my regex not matching what I expect?

The usual causes are a missing g flag (so only the first match is found), forgetting to escape special characters like . + ? ( ) [ ], or a greedy quantifier consuming more than intended. Case sensitivity also trips people up — add the i flag for case-insensitive matching. Use this tester's live highlighting and match list to see exactly where the engine stops, then refine the pattern step by step.

Where are regular expressions used in IT and security?

Regex is everywhere in technical work: parsing and filtering log files, writing SIEM and IDS detection rules, building grep/sed/awk and PowerShell one-liners, validating form input, extracting fields from text, configuring firewall and proxy rules, and search-and-replace across large codebases. A well-tested pattern can turn a noisy log into exactly the lines you need.