# spatie/regex

> Readable wrapper around PHP preg_match and preg_replace functions

Navigation: [Developer Tools](category/developer-tools.txt) · [Index](../llms.txt)

## Facts

- GitHub: https://github.com/spatie/regex
- HTML: https://awesomeopensource.dev/project/spatie-regex
- Website: https://freek.dev/549-a-package-to-easily-work-with-regex-in-php
- License: MIT
- Language: PHP
- stars: 1122
- Topics: hacktoberfest, php, regex, regular-expression
- Activity score: 3.2/5 (Maintained)
- Last commit (any branch): 2026-11-05
- Last release: 3.1.1 2021-11-30

## Description

Spatie Regex wraps PHP's preg_match, preg_match_all, preg_replace and preg_replace_callback in a small object API that returns MatchResult objects instead of reference variables and false checks. Results expose hasMatch, result, group, and fallbacks such as resultOr and groupOr. Replacement callbacks receive the MatchResult, and the package installs with Composer and ships tests.

## Maintenance activity

- Recency: 94% (weight 40%) — last commit: 8 days ago
- Commit volume: 31% (weight 25%)
- Releases: 0% (weight 25%) — last release: 1809 days ago
- Bug fixes: 100% (weight 10%)
- Commits: 2 / 90d, 3 / 365d

## Similar projects

- [stablyai/orca](stablyai-orca.md): Run several coding agents in parallel, each in its own Git worktree · Activity score 5.0/5 (Thriving)
- [tauri-apps/tauri](tauri-apps-tauri.md): Build small desktop and mobile apps with a web frontend and a Rust core · Activity score 5.0/5 (Thriving)
- [microsoft/terminal](microsoft-terminal.md): Tabs, panes and GPU rendering for PowerShell, cmd, WSL and SSH on Windows · Activity score 5.0/5 (Thriving)
- [ant-design/ant-design](ant-design-ant-design.md): A UI Design Language. · Activity score 5.0/5 (Thriving)
- [microsoft/playwright](microsoft-playwright.md): End-to-end testing and browser automation across Chromium, Firefox and WebKit · Activity score 5.0/5 (Thriving)
- [nvm-sh/nvm](nvm-sh-nvm.md): POSIX shell script for installing and switching between Node.js versions · Activity score 5.0/5 (Thriving)
