Bug #76033 [Opn]: some words, preg_match_all can't match big S correctly

From: 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

« previous php.bugs (#214164) next »