# What does \d mean in regex?

`/^\d{3}-\d{2}-\d{4}$/`

**Match a whole string consisting of exactly 3 of a digit, then "-", then exactly 2 of a digit, then "-", then exactly 4 of a digit.**

## Step by step

- `^` — Anchor to the start of the input.
- `\d{3}` — Match exactly 3 of a digit.
- `-` — Match "-".
- `\d{2}` — Match exactly 2 of a digit.
- `-` — Match "-".
- `\d{4}` — Match exactly 4 of a digit.
- `$` — Anchor to the end of the input.

## Warnings

### Anchors match string ends, not line ends (info)

Without the m flag, ^ and $ match only the very start and end of the input — not the start and end of each line. On multi-line input this is often not what was intended.

**Fix:** Add the m flag if the pattern should apply per line.

## Details

- Capture groups: none

---

Canonical URL: https://regex-explainer.gumballtools.com/regex/what-does-slash-d-mean
JSON API: `GET https://regex-explainer.gumballtools.com/api/v1/explain?pattern=...`
MCP endpoint: `https://regex-explainer.gumballtools.com/api/mcp`
