Zutily

Free Online Regex Tester

Test and debug regular expressions in real time. Match highlighting, capture groups, find & replace, common presets, all JavaScript flags, and a quick reference cheat sheet — all in your browser, completely free and private.

Share this tool

100% FreePrivacy FirstInstant ResultsNo Sign-Up
Regular Expression/g
//g
Flags:
Test String0 chars
Quick Reference
.Any character
\dDigit [0-9]
\wWord char [a-zA-Z0-9_]
\sWhitespace
^Start of string/line
$End of string/line
*0 or more
+1 or more
?0 or 1 (optional)
{n,m}Between n and m
(…)Capture group
(?:…)Non-capture group
[abc]Character class
[^abc]Negated class
a|bAlternation (or)
\bWord boundary

What Are Regular Expressions and Why Do They Matter?

A regular expression (regex) is a pattern language for matching, searching, and manipulating text. From validating email addresses and parsing log files to find-and-replace operations in code editors, regex is one of the most powerful tools in a developer's toolkit. Every major programming language — JavaScript, Python, Java, Go, PHP, Ruby — includes a native regex engine.

Despite its power, regex syntax can be cryptic. A single misplaced quantifier or unescaped character can produce silent mismatches or catastrophic backtracking. An online regex tester with real-time highlighting, capture group inspection, and flag toggling makes debugging patterns faster and safer than trial-and-error in production code.

Regex Syntax Quick Reference

PatternDescriptionExample Match
.Any character except newlinea.c → abc, a1c
\d, \w, \sDigit, word char, whitespace\d+ → 123, 42
*, +, ?0+, 1+, 0 or 1 (quantifiers)colou?r → color, colour
{n,m}Between n and m repetitions\d{3} → 123, 456
[abc], [^abc]Character class, negated class[aeiou] → vowels only
^, $Start / end of line anchors^Hello → line starts with Hello
(?=), (?!)Positive / negative lookahead\d(?=px) → digit before “px”

JavaScript Regex Flags Explained

Essential Flags

  • g (global) — match all occurrences, not just the first
  • i (insensitive) — ignore uppercase vs lowercase differences
  • m (multiline) — ^ and $ match line starts/ends, not just string boundaries

Advanced Flags

  • s (dotAll) — dot matches newlines for cross-line patterns
  • u (unicode) — full Unicode support including emoji and CJK
  • y (sticky) — match only at the current lastIndex position

Common Regex Use Cases for Developers

  • Input Validation

    Validate email addresses, phone numbers, postal codes, credit card formats, and URLs before processing. Regex catches malformed input at the boundary — before it reaches your database or API.

  • Log Parsing & Monitoring

    Extract timestamps, IP addresses, error codes, and request paths from server logs. Named capture groups let you build structured data from unstructured log lines for Elasticsearch or Datadog.

  • Code Refactoring & Migration

    Find and replace deprecated API calls, rename variables across files, or transform import statements. Regex-powered search in VS Code and IntelliJ handles bulk changes that manual editing cannot.

  • Web Scraping & Data Extraction

    Pull prices, dates, product names, and metadata from HTML pages. While full parsers are preferred for complex HTML, regex excels at extracting structured patterns from semi-structured text sources.

Want to go deeper?

Read our complete guide on regex syntax, flags, capture groups, lookaheads, and performance tips — with common patterns and real-world examples.

Frequently Asked Questions

Quick answers to common questions

A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. It is used in programming, text editors, and command-line tools to find, match, validate, and manipulate strings. For example, the regex \d{3}-\d{4} matches phone number patterns like 555-1234.
This tool supports all six JavaScript regex flags: g (global — match all occurrences), i (case insensitive), m (multiline — ^ and $ match line starts/ends), s (dotAll — . matches newlines), u (unicode — full Unicode support), and y (sticky — match from lastIndex only). Toggle any flag by clicking its button.
Capture groups are parts of a regex enclosed in parentheses ( ). They extract specific portions of a match. For example, (\d{4})-(\d{2})-(\d{2}) captures year, month, and day separately from a date string. Our tool shows each group's value under its match with labels like $1, $2, etc. Named groups (?<name>...) show their names too.
Switch to the 'Find & Replace' tab, enter your regex pattern and a replacement string. Use $1, $2, etc. to reference capture groups in the replacement. For example, pattern (\w+)@(\w+) with replacement $2/$1 would transform user@host into host/user. The replaced result updates in real time.
Presets are pre-built regex patterns for common tasks: matching email addresses, URLs, IP addresses, phone numbers, hex color codes, HTML tags, dates, credit card numbers, integers, decimal numbers, whitespace runs, and individual words. Click any preset to load it instantly.
When your regex matches parts of the test string, those portions are highlighted with a colored background in the 'Highlighted Matches' panel. Each match is numbered and you can see the exact character indices. Non-matching text remains unhighlighted for clear visual contrast.
Yes. This tool uses JavaScript's native RegExp engine, so all valid JavaScript regex syntax works — including lookaheads (?=...), lookbehinds (?<=...), named groups (?<name>...), non-greedy quantifiers (*?, +?), character classes, Unicode property escapes (with the u flag), and backreferences.
The tool displays up to 200 matches in the detail view to maintain browser performance. The total match count is always shown accurately in the stats bar regardless of the display limit. A safety limit of 10,000 iterations prevents infinite loops from patterns that match empty strings.
Yes. All regex matching happens entirely in your browser using JavaScript's built-in RegExp engine. No data is sent to any server, stored, or logged. The tool is completely stateless and private — your test strings never leave your device.
Yes, Zutily's Regex Tester is 100% free to use with no limits, no signup, and no ads. It runs entirely in your browser for maximum speed and privacy.

Disclaimer

This tool is provided “as is” for informational and utility purposes only. While we strive for accuracy, Zutily makes no warranties regarding the completeness, reliability, or suitability of the output for any specific purpose. All processing is stateless — we do not store, log, or share any data you enter. Use the results at your own discretion. For security-critical applications, always verify outputs independently.

Found this tool helpful?

Share it with your friends and colleagues