</>DevTools

RX?Regex Cheatsheet

Searchable regex reference: metacharacters, quantifiers, groups, flags, and common patterns (email, URL, phone, IP, UUID)

Basic Metacharacters

PatternDescriptionExample
.Any char except newlinea.c
^Start of line/string^Hello
$End of line/stringend$
\\Literal backslash-
|OR (a or b)cat|dog

Quantifiers

PatternDescriptionExample
*0 or moreab*c
+1 or moreab+c
?0 or 1 (optional)colou?r
{n}Exactly na{3}
{n,}n or morea{2,}
{n,m}Between n and ma{2,4}
*?0+ lazya.*?b
+?1+ lazy-

Character Classes

PatternDescriptionExample
[abc]a, b, or c-
[^abc]Not a, b, or c-
[a-z]Lowercase range-
[A-Z]Uppercase range-
[0-9]Digit range-
\dDigit [0-9]-
\DNon-digit-
\wWord char-
\WNon-word char-
\sWhitespace-
\SNon-whitespace-
\bWord boundary-
\BNon-word boundary-

Groups & References

PatternDescriptionExample
(...)Capture group(\d+)
(?:...)Non-capture group-
(?<name>...)Named group(?<year>\d{4})
\1Backreference to group 1-
(?=...)Positive lookaheadfoo(?=bar)
(?!...)Negative lookaheadfoo(?!bar)
(?<=...)Positive lookbehind-
(?<!...)Negative lookbehind-

Flags

PatternDescriptionExample
gGlobal - all matches-
iCase-insensitive-
mMultiline - ^$ per line-
sDotAll - . matches newline-
uUnicode mode-
ySticky - from lastIndex-

Common Patterns

Email

^[\w.+-]+@[\w-]+\.[\w.-]+$
Example: user@example.com

URL (HTTP/HTTPS)

^https?://[\w.-]+(?:/[^\s]*)?$
Example: https://example.com/path

KR Mobile Phone

^01[016789]-?\d{3,4}-?\d{4}$
Example: 010-1234-5678

IPv4 Address

^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$
Example: 192.168.1.1

IPv6 (simple)

^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$
Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

Date YYYY-MM-DD

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Example: 2024-12-31

Time HH:MM (24h)

^([01]\d|2[0-3]):[0-5]\d$
Example: 14:30

Hex Color

^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$
Example: #3b82f6

Korean (syllables)

[\uAC00-\uD7A3]+
Example: 안녕하세요

KR ID Number (simple)

^\d{6}-[1-4]\d{6}$
Example: 990101-1234567

Password (strong: A-z, 0-9, symbol, 8+)

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*]).{8,}$
Example: Passw0rd!

Credit Card (16 digits)

^(?:\d{4}[ -]?){3}\d{4}$
Example: 4111-1111-1111-1111

KR Business Number

^\d{3}-\d{2}-\d{5}$
Example: 123-45-67890

KR Postal Code (5 digits)

^\d{5}$
Example: 06236

UUID v4

^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
Example: 550e8400-e29b-41d4-a716-446655440000

Integer

^-?\d+$
Example: -42

Float / Decimal

^-?\d+(\.\d+)?$
Example: -3.14

Empty line

^\s*$
Example: (blank line)

HTML tag

<\/?[a-z][\s\S]*?>
Example: <div class="x">

Slug (URL-friendly)

^[a-z0-9]+(?:-[a-z0-9]+)*$
Example: hello-world-123

What is the Regex Cheatsheet?

Regular expressions have a dense syntax that is easy to forget. This cheatsheet collects metacharacters, quantifiers, character classes, groups, and flags in one place — plus a copy-ready library of real-world patterns (email, URL, phone, IP, date, UUID, and more). Use the search box to filter everything instantly.

For live matching, pair it with the regex-tester tool.

🔗Related Tools💻 Regex / Code