| name | pattern-library |
| description | Curated collection of production-ready regular expressions covering emails, URLs, dates, identifiers, and more, with copy-paste patterns and test strings |
| triggers | ["pattern library","regex patterns","common regex","email regex","url regex","date regex","uuid regex","regex collection"] |
pattern-library Skill
When to Use
Use this skill when you need a reliable regular expression for a common validation or extraction task. All patterns are tested against realistic edge cases and include example test strings.
Email
Basic Email (permissive)
\b[\w.+-]+@[\w-]+\.[\w.-]+\b
Matches most real-world email addresses. Does not enforce RFC 5322 strictly. Good for extraction.
Test: alice@example.com bob.smith+tag@co.uk noreply@system.app
Strict email (no IP literals, standard TLD)
^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$
Good for form validation. Flags: none (anchored, single address).
URL
HTTP/HTTPS URL
https?://[^\s/$.?#].[^\s]*
Flags: gi
Test: Visit https://example.com/path?q=1 or http://sub.domain.org
URL with protocol, host, path, query (with groups)
(https?):\/\/([\w.-]+)(\/[^\s?#]*)?(\\?[^\s#]*)?(#\S*)?
Groups: 1=protocol, 2=host, 3=path, 4=query, 5=fragment
Date and Time
ISO 8601 Date (YYYY-MM-DD)
\b(\d{4})-(\d{2})-(\d{2})\b
Groups: 1=year, 2=month, 3=day. Flags: g
US Date (MM/DD/YYYY)
\b(0?[1-9]|1[0-2])\/(0?[1-9]|[12]\d|3[01])\/(\d{4})\b
Groups: 1=month, 2=day, 3=year
24-hour time (HH:MM or HH:MM:SS)
\b([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?\b
ISO 8601 datetime
\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})
Numbers
Integer (positive or negative)
-?\b\d+\b
Decimal number
-?\b\d+(?:\.\d+)?\b
Currency (USD style)
\$\d{1,3}(?:,\d{3})*(?:\.\d{2})?
Test: $1,200.00 $99 $1,000,000.50
Hex number
\b0x[0-9a-fA-F]+\b
Identifiers
UUID v4
\b[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\b
Flags: gi
Hex color (3 or 6 digit)
#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b
IPv4 address
\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b
MAC address
\b(?:[0-9a-fA-F]{2}[:\-]){5}[0-9a-fA-F]{2}\b
Flags: gi
Semantic version
\bv?(\d+)\.(\d+)\.(\d+)(?:-[\w.]+)?(?:\+[\w.]+)?\b
Groups: 1=major, 2=minor, 3=patch. Flags: g
Test: v1.2.3 2.0.0-beta.1 3.1.4+build.20240101
Text and Content
Capitalized proper name (First Last)
^[A-Z][a-z]+(?:\s[A-Z][a-z]+)+$
Flags: m for multi-line input
URL slug
^[a-z0-9]+(?:-[a-z0-9]+)*$
Non-empty, non-whitespace string
^\S[\s\S]*\S$|^\S$
Repeated word (typo detector)
\b(\w+)\s+\1\b
Flags: gi
Test: the the quick brown fox fox jumps
Code and Development
HTML tag (opening)
<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>
Group 1 = tag name
CSS hex color in stylesheet
(?<=#)[0-9a-fA-F]{3,8}\b
Lookbehind requires # but excludes it from the match.
JavaScript variable name
\b[a-zA-Z_$][a-zA-Z0-9_$]*\b
Markdown heading
^(#{1,6})\s+(.+)$
Flags: gm. Group 1 = # characters, group 2 = title text.
Docker image reference
^(?:([a-z0-9.-]+(?::[0-9]+)?)\/)?((?:[a-z0-9._-]+\/)*[a-z0-9._-]+)(?::([a-zA-Z0-9._-]+))?(?:@(sha256:[a-f0-9]{64}))?$
Groups: 1=registry, 2=repository, 3=tag, 4=digest
Semantic commit message
^(feat|fix|docs|style|refactor|perf|test|chore|revert)(?:\([\w-]+\))?: .+
Flags: m
Network and Security
IPv6 address (simplified)
\b(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\b
Email header X-Forwarded-For extraction
(?:^|,\s*)(\d{1,3}(?:\.\d{1,3}){3})
JWT token structure
^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$
Base64 string
^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$
Pattern Notes
All patterns in the library use JavaScript RegExp compatible syntax. Features that require the v flag (Unicode Sets) are not included in the base library since browser support is not universal.
Patterns marked as "anchored" (^...$) are designed for full-string validation and should not use the g flag with String.prototype.test() across multiple calls -- use new RegExp(..., flags) each time or be aware of .lastIndex behavior with the g flag on test().