james2doyle/common-regex-php

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

dev-master 2019-01-21 06:31 UTC

This package is auto-updated.

Last update: 2024-09-21 21:09:28 UTC


README

talyssonoc/CommonRegexJS迁移而来

CommonRegex的PHP端口

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

欢迎提交拉取请求!

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

使用方法

composer require james2doyle/common-regex-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端口,详见此处