Bug #75069 [Com]: preg_match function wrong result

From: Date: Sun, 13 Aug 2017 13:14:50 +0000
Subject: Bug #75069 [Com]: preg_match function wrong result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210650@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75069&edit=1 ID: 75069 Comment by: spam2 at rhsoft dot net Reported by: bublik dot drdrdr at gmail dot com Summary: preg_match function wrong result Status: Open Type: Bug Package: *Regular Expressions Operating System: Windows PHP Version: 7.1.8 Block user comment: N Private report: N New Comment: can you tell why you are using preg_match() when you pretty clear deal with multibyte data to start with? the 2 multibyte chars are 2 bytes and 6+2 = 8 http://php.net/manual/en/function.mb-ereg-match.php Previous Comments: ------------------------------------------------------------------------ [2017-08-13 13:07:51] bublik dot drdrdr at gmail dot com Description: ------------ preg_match finds a wrong match with these params: pattern "(?=.*?[A-Za-z]).{8,}", subject "вasdaв". Last contains 6 chars (english and russian), but regex pattern must accept only 8+ chars. Test script: --------------- $out = array(); preg_match("/(?=.*?[A-Za-z]).{8,}/", "вasdaв", $out); var_dump($out); Expected result: ---------------- array(0) { } Actual result: -------------- array(1) { [0]=> string(8) "вasdaв" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75069&edit=1

« previous php.bugs (#210650) next »