strscan/strscan
最新稳定版本:1.0.3
Composer 安装命令:
composer require strscan/strscan
包简介
Simple string tokenizer for lexical scanning operations
README 文档
README
strscan-php is a simple string tokenizer for lexical scanning operations. It's a PHP port of strscan-js, which in turn is a JavaScript port of the Ruby library with the same name. This library assumes the mbstring extension is enabled and all strings to be UTF-8.
Installation
The recommended way to install strscan-php is through composer.
Usage
<?php include '/path/to/StrScan/StringScanner.php'; use StrScan\StringScanner; $s = new StringScanner("This is a test"); $s->scan("/\w+/"); # => "This" $s->scan("/\w+/"); # => null $s->scan("/\s+/"); # => " " $s->scan("/\s+/"); # => null $s->scan("/\w+/"); # => "is" $s->hasTerminated(); # => false $s->scan("/\s+/"); # => " " $s->scan("/(\w+)\s+(\w+)/"); # => "a test" $s->getMatch(); # => "a test" $s->getCapture(0); # => "a" $s->getCapture(1); # => "test" $s->hasTerminated(); # => true
License
strscan-php is released under the MIT license.
Acknowledgments
The original strscan-js was written by Sam Stephenson.
统计信息
- 总下载量: 141.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-08-24