PHPackages                             hotmeteor/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hotmeteor/regex

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

hotmeteor/regex
===============

A Regex library for Laravel.

v0.7(11mo ago)24457.4k↓13.9%5[2 issues](https://github.com/hotmeteor/regex/issues)MITPHPPHP ^8.2CI passing

Since Aug 9Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/hotmeteor/regex)[ Packagist](https://packagist.org/packages/hotmeteor/regex)[ RSS](/packages/hotmeteor-regex/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (8)Dependencies (5)Versions (9)Used By (0)

Regex
=====

[](#regex)

A set of ready-made regex helper methods for use in your Laravel application.

[![Latest Stable Version](https://camo.githubusercontent.com/d9b4e47537607c8ee94699c81a53b4b7a40573b8eb6957cc406ffd6cbcf01330/687474703a2f2f706f7365722e707567782e6f72672f686f746d6574656f722f72656765782f76)](https://packagist.org/packages/hotmeteor/regex)

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

[](#installation)

```
composer require hotmeteor/regex
```

Usage
-----

[](#usage)

Regex comes with a set of common regex patterns that are ready to use. These patterns can be used to either **replace** or **match** against values. Every pattern is both case-insensitive and able to interpret unicode characters, and should support all languages.

Additionally, beyond the methods below both the underlying `match` and `replace` methods are exposed to pass in custom patterns.

### Match

[](#match)

Match methods return true or false depending on if the subject value contains anything but the expected pattern.

You may optional allow whitespace by passing `true` as a second parameter.

#### Methods

[](#methods)

```
Regex::isAlpha($subject, $allowWhitespace = false)
```

Checks if the value contains anything but letters.

---

```
Regex::isAlphanumeric($subject, $allowWhitespace = false)
```

Checks if the value contains anything but letters and numbers.

---

```
Regex::isAlphadash($subject, $allowWhitespace = false)
```

Checks if the value contains anything but letters, numbers, and `.-_`.

---

```
Regex::isDigits($subject, $allowWhitespace = false)
```

Checks if the value contains anything but integers.

---

```
Regex::isNumeric($subject)
```

Checks if the value contains anything but numeric values, including decimals and negative numbers. Does not allow for whitespace.

---

```
Regex::isUuid($subject)
```

Checks if the value is a UUID. Does not allow for whitespace.

---

```
Regex::isIp($subject) // or
Regex::isIpv4($subject)
```

Checks if the value is an IPv4 address. Does not allow for whitespace.

---

```
Regex::isIpv6($subject)
```

Checks if the value is an IPv6 address. Does not allow for whitespace.

### Replace

[](#replace)

Replace methods replace anything in the subject value that doesn't match the pattern with the provided replacement.

The default replacement is nothing: it just removes the character.

#### Methods

[](#methods-1)

```
Regex::alpha($subject, $replace = '')
```

Replaces all characters in the subject except letters.

---

```
Regex::alphanumeric($subject, $replace = '')
```

Replaces all characters in the subject except letters and numbers.

---

```
Regex::alphadash($subject, $replace = '')
```

Replaces all characters in the subject except letters, numbers, and `.-_`.

---

```
Regex::digits($subject, $replace = '')
```

Replaces all characters in the subject except integers.

---

```
Regex::numeric($subject, $replace = '')
```

Replaces all characters in the subject except numeric values, including decimals and negative numbers.

---

```
Regex::uuid($subject)
```

Replaces all characters in the subject to form it into a UUID. Does not accept a replacement value.

---

```
Regex::ip($subject) // or
Regex::ipv4($subject)
```

Replaces all characters in the subject to form it into an IPv4 address. Does not accept a replacement value.

```
Regex::ipv6($subject)
```

Replaces all characters in the subject to form it into an IPv6 address. Does not accept a replacement value.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance50

Moderate activity, may be stable

Popularity47

Moderate usage in the ecosystem

Community10

Small or concentrated contributor base

Maturity59

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

Recently: every ~345 days

Total

8

Last Release

355d ago

PHP version history (3 changes)v0.1PHP ^7.4|^8.0

v0.5PHP ^8.1

v0.6PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/378585?v=4)[Adam Campbell](/maintainers/hotmeteor)[@hotmeteor](https://github.com/hotmeteor)

---

Top Contributors

[![hotmeteor](https://avatars.githubusercontent.com/u/378585?v=4)](https://github.com/hotmeteor "hotmeteor (19 commits)")

---

Tags

laravellibraryphpregex

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pipeline

The Illuminate Pipeline package.

9348.3M264](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10533.5M984](/packages/illuminate-pagination)[illuminate/redis

The Illuminate Redis package.

8314.4M356](/packages/illuminate-redis)[spatie/laravel-export

Create a static site bundle from a Laravel app

670139.5k6](/packages/spatie-laravel-export)

PHPackages © 2026

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