spatie/regex
A sane interface for php's built in preg_* functions observed · 2026-08-28
Health v2 · maintenance only
52/100
- Activity 65
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 3668
- days_rel: n/a
- days_push: 214
- n_releases_24m: 0
Adoption not part of the score
1123 stars · 49 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A PHP library providing a clean, object-oriented wrapper around PHP's built-in preg_* regex functions. It eliminates awkward patterns like pass-by-reference parameters and inconsistent false/null error returns.
Use cases
- match regex patterns in php without preg_* quirks
- extract capturing groups from strings
- replace text with regex callbacks
- get all regex matches in a subject
- handle no-match cases with defaults
When to choose
- you use PHP's preg_* functions regularly and want a cleaner API
- you want exceptions instead of false/null return values
- you prefer fluent, object-oriented regex results
When to avoid
- you need maximum performance with zero overhead
- you only use regex occasionally and raw preg_* is fine
- you're not working in PHP
Facets
library · maturity stable
parser developer-tools developer-tools programming-languages php regex preg string-processing fluent-api
3 sources
- readme: https://github.com/spatie/regex · fetched 2026-08-28 · f0391b1ec72a
- homepage: https://freek.dev/549-a-package-to-easily-work-with-regex-in-php · fetched 2026-08-29 · 4b21b6c6fa85
- site_page: https://freek.dev/about · fetched 2026-08-29 · e0ef9dccbb05
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| spatie/regex | main | 52 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem