PHPackages                             xp-framework/patterns - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xp-framework/patterns

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xp-framework/patterns
=====================

Pattern matching

v9.1.0(4y ago)05.5k2BSD-3-ClausePHPPHP &gt;=7.0.0CI failing

Since Dec 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/xp-framework/patterns)[ Packagist](https://packagist.org/packages/xp-framework/patterns)[ Docs](http://xp-framework.net/)[ RSS](/packages/xp-framework-patterns/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (9)Dependencies (2)Versions (10)Used By (2)

Pattern matching
================

[](#pattern-matching)

[![Build status on GitHub](https://github.com/xp-framework/patterns/workflows/Tests/badge.svg)](https://github.com/xp-framework/patterns/actions)[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)[![Requires PHP 7.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_0plus.svg)](http://php.net/)[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/5683e1fa4084365c08b9b5bfb1efd28e3d213b4d40812c82a7dedfba6ee468e6/68747470733a2f2f706f7365722e707567782e6f72672f78702d6672616d65776f726b2f7061747465726e732f76657273696f6e2e706e67)](https://packagist.org/packages/xp-framework/patterns)

Regular expressions and text scanning

Example
-------

[](#example)

```
use text\regex\Pattern;

$pattern= Pattern::compile('([w]{3}\.)?example\.(com|net|org)');
if ($pattern->matches($input)) {
  // Looks like an example domain
}

$result= $pattern->match($input);
$group= $result->group(0);  // [ "www.example.com", "www.", "www", "com" ]
```

Further reading
---------------

[](#further-reading)

- [RFC #165: New text.regex package](https://github.com/xp-framework/rfc/issues/165)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~284 days

Recently: every ~405 days

Total

9

Last Release

1572d ago

Major Versions

v6.6.0 → v7.0.02016-02-21

v7.1.1 → v8.0.02017-09-24

v8.0.2 → v9.0.02020-04-11

PHP version history (3 changes)v6.6.0PHP &gt;=5.5.0

v8.0.0PHP &gt;=5.6.0

v9.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07d18d882c8b4aaf3466432f64018214f2771eda333202175431ee7233795376?d=identicon)[thekid](/maintainers/thekid)

---

Top Contributors

[![thekid](https://avatars.githubusercontent.com/u/696742?v=4)](https://github.com/thekid "thekid (27 commits)")

---

Tags

phpregexscannerxp-frameworkmodulexp

### Embed Badge

![Health badge](/badges/xp-framework-patterns/health.svg)

```
[![Health](https://phpackages.com/badges/xp-framework-patterns/health.svg)](https://phpackages.com/packages/xp-framework-patterns)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
