Regex · Developer Tools

Regex Tester Online: Test Regular Expressions Instantly

Master regex faster with a live tester. This guide covers syntax, flags, common patterns, and how to use our free tool.

What is a Regular Expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Use them to validate input, extract data, find and replace text, and parse strings.

Regex Syntax Quick Reference

PatternMatches
.Any character except newline
\dAny digit (0-9)
\wWord character (a-z, A-Z, 0-9, _)
\sWhitespace (space, tab, newline)
^Start of string
$End of string
*0 or more of preceding
+1 or more of preceding
?0 or 1 of preceding (optional)
{n}Exactly n times
[abc]Character class (a, b, or c)
(group)Capture group
a|ba or b

Common Regex Flags

  • g — Global: find all matches (not just the first)
  • i — Case insensitive
  • m — Multiline: ^ and $ match line boundaries
  • s — Dotall: . matches newlines too

20 Essential Regex Patterns

# Email address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

# URL
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}

# Phone number (US)
^\+?1?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$

# IP address (IPv4)
^(\d{1,3}\.){3}\d{1,3}$

# UUID
[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

# Hex color
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$

# Date (YYYY-MM-DD)
^\d{4}-\d{2}-\d{2}$

# Strong password (8+ chars, upper, lower, digit, special)
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$

How to Use the Regex Tester

  1. Open the Regex Tester tool
  2. Enter your pattern in the Regex field (without surrounding slashes)
  3. Select your flags (g, i, m)
  4. Paste your test string — matches highlight in real time
  5. Check the Match Results panel for captured groups

Debugging Regex

  • No matches? Check if you need the g flag. Without it, only the first match is returned.
  • Greedy vs lazy? .* is greedy (matches as much as possible). Use .*? for lazy matching.
  • Special characters? Escape them with \. A literal dot is \. not .

privacy

Everything runs in your browser.

Format JSON, decode JWT, count words, generate hashes, and convert text without uploading your input.

workflow

Bookmark once, reuse daily.

A compact toolbox for recurring developer, writing, SEO, and AI-content checks.

rootnest

Part of the RootNest product stack.

Use it with OnePost, 周报侠, 内容搭子Pro, and other small focused tools.