← 返回 Skills 市场
terrycarter1985

Regex Cheatsheet

作者 terrycarter1985 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
75
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install regex-cheatsheet
功能描述
Comprehensive regex pattern library for common use cases including emails, URLs, phone numbers, dates, passwords, HTML, and more. Use when needing quick copy...
使用说明 (SKILL.md)

Regex Pattern Library

Copy-paste ready regular expressions for common use cases. Test before production use.


📧 Email & Contact Patterns

Email Address

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

# More permissive (real-world)
^[^\s@]+@[^\s@]+\.[^\s@]{2,}$

Phone Numbers

# US phone (123) 456-7890 or 123-456-7890
^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$

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

URLs

# URL with protocol
https?://[^\s/$.?#].[^\s]*

# URL (optional protocol)
(https?://)?[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+[^\s]*

# Domain name
^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z]{2,})+$

IP Addresses

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

# IPv6 (simplified)
^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$

📅 Date & Time Patterns

Dates

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

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

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

Times

# 24-hour format (HH:MM)
^([01]\d|2[0-3]):[0-5]\d$

# 24-hour with seconds
^([01]\d|2[0-3]):[0-5]\d:[0-5]\d$

# 12-hour format (HH:MM AM/PM)
^(0?[1-9]|1[0-2]):[0-5]\d\s?(AM|PM|am|pm)$

Timestamps

# ISO 8601 with timezone
^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$

🔐 Password & Security Patterns

Password Strength

# Minimum 8 chars, at least one letter and one number
^(?=.*[A-Za-z])(?=.*\d).{8,}$

# Minimum 8 chars, uppercase, lowercase, number
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$

# Strong: 8+ chars, upper, lower, number, special
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&]).{8,}$

Common Identifiers

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

# US Social Security Number (SSN)
^\d{3}-\d{2}-\d{4}$

# US ZIP Code
^\d{5}(-\d{4})?$

# UK Postcode
^[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}$

📝 Text Processing Patterns

Whitespace

# Leading whitespace
^\s+

# Trailing whitespace
\s+$

# Multiple spaces (replace with single space)
\s{2,}

# Empty lines
^\s*$

Numbers

# Integer (positive/negative)
^-?\d+$

# Decimal number
^-?\d+(\.\d+)?$

# Currency ($123.45)
^\$?\d{1,3}(,\d{3})*(\.\d{2})?$

# Percentage (12.5%)
^\d+(\.\d+)?%$

Hex Colors

# Hex color (#fff or #ffffff)
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$

# Hex with alpha
^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$

🌐 HTML & Web Patterns

HTML Tags

# Opening tag
\x3C([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>

# Closing tag
\x3C/([a-zA-Z][a-zA-Z0-9]*)>

# Self-closing tag
\x3C([a-zA-Z][a-zA-Z0-9]*)\b[^>]*/>

HTML Comments

\x3C!--[\s\S]*?-->

CSS Classes/IDs

# Class selector
class="([^"]*)"

# ID selector
id="([^"]*)"

Markdown

# Heading level 1-6
^#{1,6}\s.+$

# Bold text
\*\*([^*]+)\*\*

# Italic text
\*([^*]+)\*

# Link
\[([^\]]*)\]\(([^)]*)\)

📂 File & Path Patterns

File Extensions

# Image files
\.(jpg|jpeg|png|gif|bmp|webp|svg)$

# Document files
\.(pdf|doc|docx|txt|xls|xlsx|ppt|pptx)$

# Code files
\.(js|ts|py|java|cpp|c|h|go|rs|rb|php)$

File Paths

# Unix path
^(/[^/]+)+/?$

# Windows path
^[A-Za-z]:\\([^\\]+\\)*[^\\]*$

# Filename (no path)
[^/\\]+$

🔍 Useful Regex Constructs

Lookarounds

# Positive lookahead
foo(?=bar)       # "foo" followed by "bar"

# Negative lookahead
foo(?!bar)       # "foo" NOT followed by "bar"

# Positive lookbehind
(?\x3C=foo)bar      # "bar" preceded by "foo"

# Negative lookbehind
(?\x3C!foo)bar      # "bar" NOT preceded by "foo"

Groups & Capture

# Capture group
(foo|bar)

# Non-capturing group
(?:foo|bar)

# Named group (Python/JS)
(?P\x3Cname>pattern)

# Backreference
(["'])\w+\1      # Matches quoted text with same quotes

💡 Quick Reference Table

Pattern Regex
Email ^[^\s@]+@[^\s@]+\.[^\s@]{2,}$
URL https?://[^\s/$.?#].[^\s]*
IPv4 `^((25[0-5]
UUID ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
YYYY-MM-DD ^\d{4}-\d{2}-\d{2}$
Hex color ^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$

⚠️ Important Notes

  1. Test thoroughly: Always test regex patterns with your specific data
  2. Escape properly: Different languages/engines may require different escaping
  3. Performance: Complex regex can be slow on large inputs
  4. HTML parsing: Regex cannot fully parse HTML - use proper parsers when possible
  5. Email validation: No perfect email regex exists - send verification emails instead
  6. Security: Regex denial-of-service (ReDoS) is possible with certain patterns

Testing Tools

安全使用建议
This skill appears safe from an agentic security perspective. Treat the regexes as examples rather than production-ready security controls, and test them against your own data before use.
功能分析
Type: OpenClaw Skill Name: regex-cheatsheet Version: 1.0.0 The skill bundle is a purely informational regex pattern library. It contains standard regular expressions for common tasks like validating emails, URLs, and dates, and includes helpful security warnings regarding Regex Denial of Service (ReDoS) and the limitations of parsing HTML with regex. There is no executable code or malicious instructions present in SKILL.md or _meta.json.
能力评估
Purpose & Capability
The artifacts consistently describe a copy-paste regex pattern library, and the provided content matches that purpose.
Instruction Scope
Instructions are limited to reference material and advice to test regex patterns; there are no agent-control, override, or autonomous action instructions.
Install Mechanism
No install spec, binaries, package dependencies, scripts, or code files are present.
Credentials
The skill requests no environment variables, credentials, files, network access, or OS-specific capabilities.
Persistence & Privilege
No persistence, background execution, account authority, privilege escalation, or local state storage is shown.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install regex-cheatsheet
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /regex-cheatsheet 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release - Comprehensive regex pattern library for emails, URLs, phone numbers, dates, passwords, HTML, file paths, and more with copy-paste ready patterns
元数据
Slug regex-cheatsheet
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Regex Cheatsheet 是什么?

Comprehensive regex pattern library for common use cases including emails, URLs, phone numbers, dates, passwords, HTML, and more. Use when needing quick copy... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 75 次。

如何安装 Regex Cheatsheet?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install regex-cheatsheet」即可一键安装,无需额外配置。

Regex Cheatsheet 是免费的吗?

是的,Regex Cheatsheet 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Regex Cheatsheet 支持哪些平台?

Regex Cheatsheet 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Regex Cheatsheet?

由 terrycarter1985(@terrycarter1985)开发并维护,当前版本 v1.0.0。

💬 留言讨论