# Regex

> Pattern matching.

- Skill: `dhaupin/regex` (Agent Skill)
- Install (CLI): `npx skillmds@latest add dhaupin/regex`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dhaupin/regex/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: dhaupin (https://skillmd.com/u/dhaupin)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/dhaupin/regex

---


# Regex

> Pattern matching.

---

## When To Use

- Find patterns
- Validate input
- Extract data

---

## What To Do

### 1. Basics

| Pattern | What |
|---------|------|
| . | Any character |
| * | 0 or more |
| + | 1 or more |
| ? | 0 or 1 |
| ^ | Start |
| $ | End |

### 2. Classes

```regex
[abc]       # a, b, or c
[^abc]      # not a, b, c
[a-z]       # a to z
\d          # digit
\w          # word
\s          # space
```

### 3. Groups

```regex
(abc)       # Capture
(?:abc)     # Non-capture
(?<name>abc) # Named
```

### 4. Use

```javascript
const match = str.match(/\d+/g)
const valid = /^\S+@\S+\.\S+$/.test(email)
```

---

**Role**: Regex Developer  
**Input**: String + pattern  
**Output**: Match

> Patterns.
