rkr/wildcards 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rkr/wildcards

Composer 安装命令:

composer require rkr/wildcards

包简介

A simple wildcard matcher

README 文档

README

Build Status Scrutinizer Code Quality

This project aims to provide a dead simple component for php to support wildcards. Wildcards are * (zero or more character) and ? (exactly one character). The component is not tied to filenames. You can use it also for namespaces, urls and other strings.

Why can't you just provide a simple function for this?

Because of effectivity. When you create an instance of the Pattern-class, you also "compile" the pattern. This means that I try to find the optimal test method for your later input. So if you run the same pattern more often in the same run, you could benefit from that optimization. If not, the Interface should still be simple enough to make you happy. If not, go wrap a function around it.

Why not just use regular expressions?

Because there is no reason to use regular expressions for the most common figures:

string* means "starts with".
*string means "ends with".

So even if I use regular expressions to cover complex patterns, it is too pointless to use regular expressions for one of these. Internally I use substr() instead. If you like to provide more speedups for such simple patterns, feel free to push me some.

Composer:

composer require rkr/wildcards ^1.0

Example:

<?php
use Kir\StringUtils\Matching\Wildcards\Pattern;

(new Pattern('test.*'))->match('test.txt');      // true
Pattern::create('test.*')->match('test.txt');    // true
Pattern::create('*.txt')->match('test.txt');     // true
Pattern::create('*.*')->match('test.txt');       // true
Pattern::create('test*txt')->match('test.txt');  // true
Pattern::create('test?txt')->match('test.txt');  // true
Pattern::create('t*.???')->match('test.txt');    // true
Pattern::create('t*t?.txt')->match('test8.txt'); // true

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-11-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固