Bug #76033 [Opn]: some words, preg_match_all can't match big S correctly
| From: | master at hiroz dot cn | Date: | Thu, 01 Mar 2018 13:12:56 +0000 |
| Subject: | Bug #76033 [Opn]: some words, preg_match_all can't match big S correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214164@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76033&edit=1
ID: 76033
User updated by: master at hiroz dot cn
Reported by: master at hiroz dot cn
Summary: some words, preg_match_all can't match big S
correctly
Status: Open
Type: Bug
Package: PCRE related
Operating System: macOS 10.12.6
PHP Version: 5.6.33
Block user comment: N
Private report: N
New Comment:
please try it in macOS again.
Previous Comments:
------------------------------------------------------------------------
[2018-03-01 12:03:27] cmb@php.net
I cannot reproduce the described behavior:
<https://3v4l.org/UeP92>.
------------------------------------------------------------------------
[2018-03-01 03:29:10] master at hiroz dot cn
Description:
------------
preg_match_all can't match \S correctly
in php5.4 ~ php5.6.33
```
$matches = array();
$template = '<p>{{{ åè´§åå· }}}</p><p>{{{
åæ®123å· }}}</p><p>{{{ æå
}}}</p><p>{{{ a
}}}</p><p>{{{ a }}}</p>';
$ret = preg_match_all('/\{\{\{ \S+ \}\}\}/', $template, $matches);
print_r($matches);
```
result is
```
Array
(
[0] => Array
(
[0] => {{{ åè´§åå· }}}
[1] => {{{ åæ®123å· }}}
[2] => {{{ a }}}
[3] => {{{ a }}}
)
)
```
the "æå
" is missing. i try many cases. "å
" can't be matched
by "\S".
but in php5.3 or other languages, "å
" can be matched by "\S".
Test script:
---------------
$matches = array();
$template = '<p>{{{ åè´§åå· }}}</p><p>{{{
åæ®123å· }}}</p><p>{{{ æå
}}}</p><p>{{{ a
}}}</p><p>{{{ a }}}</p>';
$ret = preg_match_all('/\{\{\{ \S+ \}\}\}/', $template, $matches);
print_r($matches);
Expected result:
----------------
Array
(
[0] => Array
(
[0] => {{{ åè´§åå· }}}
[1] => {{{ åæ®123å· }}}
[2] => {{{ æå
}}}
[3] => {{{ a }}}
[4] => {{{ a }}}
)
)
Actual result:
--------------
Array
(
[0] => Array
(
[0] => {{{ åè´§åå· }}}
[1] => {{{ åæ®123å· }}}
[2] => {{{ a }}}
[3] => {{{ a }}}
)
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76033&edit=1