承接 chevere/regex 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chevere/regex

最新稳定版本:1.0.2

Composer 安装命令:

composer require chevere/regex

包简介

Validated regular expression

README 文档

README

Chevere

Build Code size Apache-2.0 PHPStan Mutation testing badge

Quality Gate Status Maintainability Rating Reliability Rating Security Rating Coverage Technical Debt CodeFactor

Summary

Regex enables to work with a validated regular expression.

Installing

Regex is available through Packagist and the repository source is at chevere/regex.

composer require chevere/regex

Creating Regex

Create a Regex by passing the regular expression pattern.

use Chevere\Regex\Regex;

$regex = new Regex('/^Hello World!$/');

Reading pattern

As-is

The __toString method is used to access the pattern passed on instance creation.

$string = $regex->__toString();
// /^Hello World!$/

Without delimiters

The noDelimiters method is used to access to the regex pattern without delimiters.

$string = $regex->noDelimiters();
// ^Hello World!$

Without delimiters and anchors

The noDelimitersNoAnchors method is used to access to the regex pattern without delimiters and anchors.

$string = $regex->noDelimitersNoAnchors();
// Hello World!

Match

The match method provides preg_match.

$array = $regex->match('Hello World!');
// [Hello World!]

Match All

The matchAll method provides preg_match_all.

$regex->matchAll();
// [Hello World!]

Assert Match

The assertMatch method asserts that the string matches. It throws Exceptions\NoMatchException when failing to assert.

$regex->assertMatch('Hello World!');

Assert Match All

The assertMatchAll method asserts that the string matches all. It throws Exceptions\NoMatchException when failing to assert.

$regex->assertMatchAll('Hello World!');

Documentation

Documentation is available at chevere.org.

License

Copyright 2024 Rodolfo Berrios A.

Chevere is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

统计信息

  • 总下载量: 20.1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2023-11-30