lyteworx/common-regex2-php

在字符串中查找多种常见信息

dev-master 2021-06-24 19:45 UTC

This package is auto-updated.

Last update: 2024-09-25 03:29:43 UTC


README

由james2doyle/CommonRegexPHP (https://github.com/james2doyle/CommonRegexPHP) 分支而来

添加额外的正则表达式搜索。

talyssonoc/CommonRegexJS 迁移而来

CommonRegex 的 PHP 版本

在字符串中查找多种常见信息。

欢迎提交pull request!

请注意,目前仅针对英语/美国地区。

用法

composer require lyteworx/common-regex2-php

然后在代码的某个位置

$parser = new CommonRegexPHP;
$results = $parse('See you at 12:00AM on March 22nd 2018');
// returns [
//     'dates' => [
//         'March 22nd 2018',
//     ],
//     'times' => [
//         '12:00AM',
//     ],
// ]

// shorthand
$results = (new CommonRegexPHP)('See you at 12:00AM on March 22nd 2018');

运行测试

composer install
composer run test

CommonRegex 端口

其他语言也存在 CommonRegex 端口,请参阅此处