php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68515 preg_match
Submitted: 2014-11-27 10:27 UTC Modified: 2014-11-27 10:36 UTC
From: ian dot email at qq dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.5.12 OS: win7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ian dot email at qq dot com
New email:
PHP Version: OS:

 

 [2014-11-27 10:27 UTC] ian dot email at qq dot com
Description:
------------
if(preg_match('/\\u8def/i', "\u535a\u5174\u8def"))
	echo 55555;
exit;

Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1 

Test script:
---------------
if(preg_match('/\\u8def/i', "\u535a\u5174\u8def"))
	echo 55555;
exit;

Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1 

Expected result:
----------------
if(preg_match('/\\u8def/i', "\u535a\u5174\u8def"))
	===> echo 55555;
exit;

Actual result:
--------------
if(preg_match('/\\\u8def/i', "\u535a\u5174\u8def"))  ? \\\?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-27 10:28 UTC] ian dot email at qq dot com
PHP Version 5.5.12
 [2014-11-27 10:36 UTC] requinix@php.net
-Status: Open +Status: Not a bug -PHP Version: 5.6.3 +PHP Version: 5.5.12
 [2014-11-27 10:36 UTC] requinix@php.net
PHP doesn't have a \u escape sequence, though it is being discussed for a future version. Thus the "\u" will remain in the string as a literal backslash and 'u' and you'll get the warning.
 [2014-11-28 01:29 UTC] ian dot email at qq dot com
i want regular JSON data
 [2014-11-28 01:37 UTC] ian dot email at qq dot com
if(preg_match('/(\\\)u8def/i', "\u535a\u5174\u8def"))
	echo 55555;
exit;

three  backslash '\\\' will ok, i should use '\\\'?
 [2014-11-28 04:22 UTC] ian dot email at qq dot com
thank you,i konw how to deail it
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC