|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-07-26 03:37 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
-Package: *Regular Expressions
+Package: PCRE related
[2021-07-26 03:37 UTC] requinix@php.net
[2021-07-26 14:19 UTC] 958268052 at qq dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 06:00:01 2025 UTC |
Description: ------------ I executed this test script below, redirecting the result to a file, and I got an execution result of "Â". When I execute it on other regular expression engines like java and python using the same regular expression and string, they both result in "£", unlike PHP. I don't understand why PHP has such a different result, is this a special implementation of the PHP regular expression engine or a defect in the engine? Test script: --------------- <?php function matchTest($reg,$str){ preg_match($reg,$str,$r); if (empty($r)) { return ""; } else{ return $r[0]; } } $regex = "/[£]/"; $testString = "£"; $result = matchTest($regex, $testString); print_r($result); ?> Expected result: ---------------- £ Actual result: -------------- Â