Regex Pattern Reference

Anchors

^

Start of string

Example
^Hello matches 'Hello' at start
$

End of string

Example
world$ matches 'world' at end
\b

Word boundary

Example
\bword\b matches 'word' as whole word
\B

Not a word boundary

Example
\Bword matches 'sword' but not 'word '

Character Classes

.

Any character except newline

Example
a.c matches 'abc', 'a1c'
\d

Any digit (0-9)

Example
\d+ matches '123'
\D

Any non-digit

Example
\D+ matches 'abc'
\w

Word character (a-z, A-Z, 0-9, _)

Example
\w+ matches 'hello_123'
\W

Non-word character

Example
\W+ matches '!@#'
\s

Whitespace character

Example
\s+ matches spaces, tabs
\S

Non-whitespace character

Example
\S+ matches 'hello'
[abc]

Any character in set

Example
[aeiou] matches vowels
[^abc]

Any character not in set

Example
[^0-9] matches non-digits
[a-z]

Character range

Example
[a-zA-Z] matches letters

Quantifiers

*

0 or more

Example
a* matches '', 'a', 'aa'
+

1 or more

Example
a+ matches 'a', 'aa' but not ''
?

0 or 1

Example
colou?r matches 'color' and 'colour'
{n}

Exactly n times

Example
a{3} matches 'aaa'
{n,}

n or more times

Example
a{2,} matches 'aa', 'aaa'
{n,m}

Between n and m times

Example
a{2,4} matches 'aa', 'aaa', 'aaaa'
*?

0 or more (lazy)

Example
a*? matches as few as possible
+?

1 or more (lazy)

Example
a+? matches as few as possible

Groups

(abc)

Capturing group

Example
(\d+) captures numbers
(?:abc)

Non-capturing group

Example
(?:ab)+ matches 'ababab'
(a|b)

Alternation

Example
(cat|dog) matches 'cat' or 'dog'
(?<name>abc)

Named capturing group

Example
(?<year>\d{4}) captures as 'year'

Lookaround

(?=...)

Positive lookahead

Example
\d(?=px) matches '10' in '10px'
(?!...)

Negative lookahead

Example
\d(?!px) matches '10' not followed by 'px'
(?<=...)

Positive lookbehind

Example
(?<=\$)\d+ matches '10' in '$10'
(?<!...)

Negative lookbehind

Example
(?<!\$)\d+ matches '10' not after '$'

Flags

g

Global - find all matches

Example
/test/g finds all 'test'
i

Case insensitive

Example
/test/i matches 'Test', 'TEST'
m

Multiline - ^ and $ match line boundaries

Example
/^test/m matches 'test' at line start
s

Dot matches newline

Example
/a.b/s matches 'a\nb'
u

Unicode

Example
/\u{1F600}/u matches emoji
y

Sticky - matches from lastIndex

Example
/test/y matches at exact position

Special Characters

\

Escape special character

Example
\. matches literal '.'
\n

Newline

Example
line1\nline2
\r

Carriage return

\t

Tab character

\0

Null character

Common Patterns

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

Email address

Example
user@example.com
^https?://[^\s]+$

URL

Example
https://example.com
^\d{3}-\d{3}-\d{4}$

Phone number (US)

Example
123-456-7890
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$

Hex color

Example
#FF5733 or #F57
^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,}$

Strong password

Example
Abc12345
^\d{4}-\d{2}-\d{2}$

Date (YYYY-MM-DD)

Example
2024-01-15
^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$

IPv4 address

Example
192.168.1.1

What is Regex Memo?

Regex Memo is an interactive regular expression reference and cheatsheet that provides quick access to essential regex patterns. Whether you're a developer writing validation logic, a data engineer parsing text, or a QA engineer testing patterns, our memo provides categorized patterns with descriptions instantly.

This tool organizes regex patterns by category including anchors, quantifiers, character classes, groups, lookarounds, and common patterns. Search functionality helps you find specific patterns and syntax instantly.

Why Use Regex Memo?

Regular expressions have complex syntax that's difficult to memorize. Developers need quick access to pattern syntax, especially for advanced features like lookaheads, backreferences, and Unicode properties. Manual searching through documentation wastes valuable development time.

Developers use this memo to quickly find correct pattern syntax, learn regex features, and avoid common mistakes. Data engineers benefit from ready-to-use patterns for email validation, URL parsing, and data extraction.

The tool saves time by providing instant pattern lookup, includes practical examples for each pattern, and organizes patterns by functionality. It's particularly valuable when writing validation logic, parsing text data, and implementing search functionality.

Common Use Cases

Input Validation: Reference patterns for email, phone, URL, and data validation.

Text Parsing: Find patterns for extracting data from structured text.

Search Functionality: Learn regex syntax for implementing advanced search features.

Data Cleaning: Access patterns for removing, replacing, and formatting text.

Log Analysis: Use patterns for parsing and analyzing log files.

How to Use Regex Memo

Using Regex Memo is straightforward: browse patterns by category or search for specific syntax, click on patterns to see detailed descriptions and examples, copy patterns to clipboard with one click, and test patterns with sample text. The memo includes common use cases and best practices.

All patterns are organized logically with practical examples you can adapt to your needs. The tool works entirely in your browser without requiring any installation.

Related Tools

Explore more tools to enhance your productivity