PHPackages                             cline/ecma-regex - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. cline/ecma-regex

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

cline/ecma-regex
================

100% ECMA-262 compliant regular expression engine for PHP, designed for JSON Schema validation and full JavaScript regex compatibility

2.0.2(3mo ago)10MITPHPPHP ^8.5.0CI passing

Since Mar 4Pushed 3mo agoCompare

[ Source](https://github.com/faustbrian/ecma-regex)[ Packagist](https://packagist.org/packages/cline/ecma-regex)[ RSS](/packages/cline-ecma-regex/feed)WikiDiscussions 2.x Synced today

READMEChangelog (1)Dependencies (6)Versions (6)Used By (0)

[![GitHub Workflow Status](https://github.com/faustbrian/ecma-regex/actions/workflows/quality-assurance.yaml/badge.svg)](https://github.com/faustbrian/ecma-regex/actions)[![Latest Version on Packagist](https://camo.githubusercontent.com/8bec758ec44afa9df5527d33d174e38899cb8874d1ff46ec75b4bd61cab5893e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636c696e652f65636d612d72656765782e737667)](https://packagist.org/packages/cline/ecma-regex)[![Software License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/ed019abddd81dc5f997fdcca86481189c9aeff6949d3563a78936a85f89d804c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c696e652f65636d612d72656765782e737667)](https://packagist.org/packages/cline/ecma-regex)

---

ecma-regex
==========

[](#ecma-regex)

A 100% ECMA-262 compliant regular expression engine for PHP, designed for JSON Schema validation and full JavaScript regex compatibility.

Why This Package?
-----------------

[](#why-this-package)

PHP uses PCRE (Perl Compatible Regular Expressions), while JSON Schema and JavaScript use ECMA-262 regex syntax. These engines have subtle differences that can cause validation inconsistencies. This package provides a pure PHP implementation of ECMA-262 regex, ensuring perfect compatibility with JSON Schema patterns.

Requirements
------------

[](#requirements)

> **Requires [PHP 8.5+](https://php.net/releases/)**

Installation
------------

[](#installation)

```
composer require cline/ecma-regex
```

Usage
-----

[](#usage)

See the [Getting Started](https://docs.cline.sh/ecma-regex/getting-started/) guide for usage examples and the [API Reference](https://docs.cline.sh/ecma-regex/api-reference/) for complete API documentation.

Documentation
-------------

[](#documentation)

Comprehensive documentation available at [docs.cline.sh](https://docs.cline.sh/ecma-regex/):

- **[Getting Started](https://docs.cline.sh/ecma-regex/getting-started/)** - Installation and basic usage
- **[Pattern Syntax](https://docs.cline.sh/ecma-regex/pattern-syntax/)** - Complete pattern reference
- **[API Reference](https://docs.cline.sh/ecma-regex/api-reference/)** - Full API documentation
- **[JSON Schema Integration](https://docs.cline.sh/ecma-regex/json-schema/)** - JSON Schema validation patterns
- **[Performance](https://docs.cline.sh/ecma-regex/performance/)** - Caching and optimization
- **[Architecture](https://docs.cline.sh/ecma-regex/architecture/)** - Internal design and structure
- **[Troubleshooting](https://docs.cline.sh/ecma-regex/troubleshooting/)** - Common issues and solutions

**External References:**

- [ECMA-262 Specification](https://tc39.es/ecma262/#sec-regexp-regular-expression-objects)
- [JSON Schema Regular Expressions](https://json-schema.org/understanding-json-schema/reference/regular_expressions)

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please use the [GitHub security reporting form](https://github.com/faustbrian/ecma-regex/security) rather than the issue queue.

Credits
-------

[](#credits)

- [Brian Faust](https://github.com/faustbrian)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License. Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance80

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~21 days

Total

5

Last Release

108d ago

Major Versions

1.0.0 → 2.0.02026-03-04

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22145591?v=4)[Brian Faust](/maintainers/faustbrian)[@faustbrian](https://github.com/faustbrian)

---

Top Contributors

[![faustbrian](https://avatars.githubusercontent.com/u/22145591?v=4)](https://github.com/faustbrian "faustbrian (6 commits)")

---

Tags

phpjson-schemajavascriptregexregular expressionsecma-262

### Embed Badge

![Health badge](/badges/cline-ecma-regex/health.svg)

```
[![Health](https://phpackages.com/badges/cline-ecma-regex/health.svg)](https://phpackages.com/packages/cline-ecma-regex)
```

PHPackages © 2026

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