PHPackages                             amoy/phpregex - 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. amoy/phpregex

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

amoy/phpregex
=============

php simple regex

v1.0.1(7y ago)119MITPHPPHP &gt;=7.0.0

Since Aug 14Pushed 3y agoCompare

[ Source](https://github.com/liu00700/phpregex)[ Packagist](https://packagist.org/packages/amoy/phpregex)[ RSS](/packages/amoy-phpregex/feed)WikiDiscussions master Synced 3d ago

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

phpregex
========

[](#phpregex)

phpregex 是一个正则工具，内置部分常用的正则表达式，重要的是包含一个正则工具，让新手也能简单的使用正则而不需要去深入学习正则表达式。

Composer Installation
---------------------

[](#composer-installation)

Packagist：

```
composer require amoy/phpregex

```

Usage
-----

[](#usage)

```

$demo_txt='11,sdf fds s aaaa@aa.com , 111.111.111.11 ,vandewqfod@yahoo.com, http://github.com';

$res=RegexSearch::setSubject($demo_txt)->Ip()->First();  //111.111.111.11

$res=RegexSearch::setSubject($demo_txt)->Email()->First(); //aaaa@aa.com

$res=RegexSearch::setSubject($demo_txt)->Email()->Last(); //vandewqfod@yahoo.com

$res=RegexSearch::setSubject($demo_txt)->Email()->All(); //['aaaa@aa.com','vandewqfod@yahoo.com']

$res=RegexSearch::setSubject($demo_txt)->Url()->All(); // ['http://github.com']

$res=RegexSearch::setSubject($demo_txt)->setRegex("/[1-9]\d*/")->First(); // 11

```

More Usage
----------

[](#more-usage)

```
$res=RegexSearch::setSubject($demo_txt)->CustomRegex('aaa','a@','yahoo','.com',true,true)->First();
//a@aa.com xxxdkfje4i2333 d34fsd 111.111.111.11 ,vandewqfod@yahoo

     * @param string $front 以此字符串开头，但不包含在结果里面
     * @param string $begin 以此字符串开头，包含在结果里面
     * @param string $end   以此字符串结尾，包含在结果里面
     * @param string $last  以此字符串结尾，但不包含在结果里面
     * @param bool $is_short    是否使用最短匹配
     * @param bool $enable_break    是否包含换行匹配搜索
     CustomRegex($front='',$begin='',$end='',$last='',$is_short=true,$enable_break=false)
     详解： $begin必须紧随着$front字符串， $last必须紧随着$end字符串，

```

Features
--------

[](#features)

```
增加替换
增加内置常用正则

```

[soccer jerseys](https://www.soccersjerseys.com/)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.3% 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 ~4 days

Total

2

Last Release

2826d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f385f5828742fcf561d901aa56c09b422546a654b203b5d64251fca2fcfb4e39?d=identicon)[liu00700](/maintainers/liu00700)

---

Top Contributors

[![amoyJun](https://avatars.githubusercontent.com/u/22805477?v=4)](https://github.com/amoyJun "amoyJun (7 commits)")[![liu00700](https://avatars.githubusercontent.com/u/22067566?v=4)](https://github.com/liu00700 "liu00700 (5 commits)")

### Embed Badge

![Health badge](/badges/amoy-phpregex/health.svg)

```
[![Health](https://phpackages.com/badges/amoy-phpregex/health.svg)](https://phpackages.com/packages/amoy-phpregex)
```

PHPackages © 2026

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