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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Apr 16 07:01:29 2024 UTC