/writer-devregex-cheatsheet
Writer & Dev

RegEx Cheatsheet: Regular Expression Syntax, Flags and Recipes

Look up regular expression syntax fast and copy tested recipes for emails, URLs, IPs, dates, hex colours and UUIDs. Every pattern is one click away from the regex tester.

Runs in your browser — your text is never uploaded or stored.

Quick answer

RegEx Cheatsheet Generator is a free online tool that look up regular expression syntax fast and copy tested recipes for emails, URLs, IPs, dates, hex colours and UUIDs. Every pattern is one click away from the regex tester.

  • Cost: free, no signup or limits.
  • Privacy: runs 100% in your browser; text is never uploaded.
  • Works on: desktop and mobile browsers, offline once loaded.
  • Category: Writer & Dev.

Ready-made patterns

Email address
[\w.+-]+@[\w-]+\.[\w.-]+
matches: hello@snipptext.com
URL
https?:\/\/[^\s"'<>]+
matches: https://snipptext.com/tools
IPv4 address
\b(?:\d{1,3}\.){3}\d{1,3}\b
matches: 192.168.1.10
Date YYYY-MM-DD
\d{4}-\d{2}-\d{2}
matches: 2026-08-19
Hex color
#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b
matches: #1f8a70
UUID v4
[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}
matches: 3f1c9a2e-4b7d-4f2a-9c1e-6b0a1d2e3f44
Phone (international)
\+?\d[\d\s().-]{7,}\d
matches: +44 20 7946 0958
Whitespace runs
\s{2,}
matches: too many spaces
HTML tag
<\/?[a-zA-Z][^>]*>
matches: <div class="x">
Slug
^[a-z0-9]+(?:-[a-z0-9]+)*$
matches: regex-cheatsheet
→ Test any pattern in the Regex Tester

Character classes

.Any character except newline
\dDigit 0-9
\DNot a digit
\wWord character [A-Za-z0-9_]
\WNot a word character
\sWhitespace
[abc]Any of a, b or c
[^abc]Not a, b or c
[a-z]Range a to z

Quantifiers

*0 or more
+1 or more
?0 or 1 (optional)
{3}Exactly 3
{2,}2 or more
{2,5}Between 2 and 5
*?Lazy — as few as possible

Anchors & boundaries

^Start of string / line
$End of string / line
\bWord boundary
\BNot a word boundary

Groups & lookaround

(abc)Capturing group
(?:abc)Non-capturing group
(?<name>abc)Named group
a|bAlternation: a or b
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind

Flags

gGlobal — all matches
iCase insensitive
mMultiline ^ and $
sDot matches newline
uUnicode

How to Use

  1. 1.Search the cheatsheet for the token or concept you need.
  2. 2.Browse the recipe list for a ready-made pattern such as email or IPv4.
  3. 3.Copy the pattern and test it against your own text in the regex tester.
Advertisement

FAQ

Which regex flavour is this?

JavaScript (ECMAScript) regex, which is close to PCRE for everyday patterns.

Can I test the patterns here?

Yes — each recipe includes a sample string and links straight to the regex tester tool.

Is lookbehind supported?

Yes in modern browsers. Lookbehind works in Chrome, Edge, Firefox and Safari 16.4 or newer.

Related tools

More text utilities