Tools/Backend & API/Regex Tester

Regex Tester

Test regular expressions with live matching, replace mode, code generation, and more.

Regular Expression

/ /
Flags:

Test String

Highlighted Matches

Match Details

Generate Code

Copied to clipboard

Regex cheat sheet — the syntax you actually need

Regex looks cryptic until you recognize the building blocks. Keep this open while writing expressions:

SymbolMeaningExample
.Any character except newlinea.c matches "abc", "a1c"
\dAny digit (0-9)\d+ matches "123"
\wWord character (a-z, A-Z, 0-9, _)\w+ matches identifiers
\sWhitespace (space, tab, newline)\s+ collapses multiple spaces
^Start of line / string^Hello
$End of line / stringworld$
*0 or more (greedy)a*
+1 or more (greedy)a+
?0 or 1 (optional)colou?r matches color or colour
*?, +?Non-greedy (lazy)<.*?> matches single HTML tag
{n,m}Between n and m repetitions\d{3,5}
[abc]Any one of a, b, c[aeiou]
[^abc]Not a, b, or c[^0-9]
(abc)Capture group(\d+)-(\d+)
(?:abc)Non-capturing group
|Alternation (OR)cat|dog
\bWord boundary\bcat\b doesn't match "category"

Common regex patterns — email, URL, phone, date

Copy-ready patterns for everyday validation. None are perfectly correct (email validation in particular is infamously hard) but these cover 99%+ of real input:

# Email (reasonable, not RFC 5322 compliant — nobody's is)
^[\w.+-]+@[\w-]+\.[\w.-]+$

# URL (http/https)
^https?://[\w\-.]+(\.\w+)+(/\S*)?$

# International phone (E.164)
^\+?[1-9]\d{1,14}$

# US phone
^\(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4}$

# Indian phone (+91, 10 digits)
^(\+91|91)?[6-9]\d{9}$

# Date YYYY-MM-DD
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$

# IPv4 address
^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$

# UUID v4
^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

# Strip HTML tags
<[^>]+>

# Whitespace (collapse multiple → one)
\s+

Regex engines differ — JavaScript vs Python vs PCRE

The same regex can behave differently across languages. Mostly minor but catches people off guard:

  • JavaScript — no lookbehind ((?<=...)) until ES2018; limited Unicode support without /u flag.
  • Python re — no possessive quantifiers (a++), uses (?P<name>...) for named groups (vs (?<name>...) elsewhere).
  • PCRE (PHP, nginx) — most powerful, supports everything including recursion and conditional patterns.
  • Java java.util.regex — strict backslash escaping in source code. \\d in a Java string literal.
  • Go regexp — RE2 engine, no backreferences or lookaround. Fast + safe but less expressive.
  • Rust regex — also RE2-style, guaranteed linear time.
  • grep BRE — basic regex. + ? | () all need backslash escaping. Use grep -E for extended.

Our tester uses the JavaScript engine in your browser — same one as your production code if you're targeting Node or browsers. If you need PCRE or Python semantics specifically, mirror the pattern to regex101.com and select the corresponding flavor.

Frequently Asked Questions

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern, used for string matching, validation, and text manipulation.

What do regex flags mean?

g (global) finds all matches, i (case insensitive) ignores case, m (multiline) makes ^ and $ match line boundaries, s (dotall) makes . match newlines.

How do capture groups work?

Parentheses () create capture groups that extract specific parts of a match. Reference them with $1, $2, etc. in replacements.

Copyright © 2026 BuildStudio. All rights reserved.

Designed and Developed by Webority Technologies