Bug #61775 [Opn->Nab]: Preg_match does not support unicode.
| From: | cataphract@php.net | Date: | Thu, 19 Apr 2012 21:09:09 +0000 |
| Subject: | Bug #61775 [Opn->Nab]: Preg_match does not support unicode. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-169746@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61775&edit=1
ID: 61775
Updated by: cataphract@php.net
Reported by: asersz at gmail dot com
Summary: Preg_match does not support unicode.
-Status: Open
+Status: Not a bug
Type: Bug
Package: PCRE related
Operating System: MacOS Lion 10.7.2
PHP Version: 5.4.0
Block user comment: N
Private report: N
New Comment:
Your expression is wrong. Version 8.02 of PCRE, which you're using, gives that rather cryptic
error, but more recent versions, including the one bundled with PHP say:
Warning: preg_match(): Compilation failed: unrecognized character after (?P at offset 4 in - on line
3
Probably you want something like:
<?php
$r='/^(?P<foo>\w+)\/(?P<bar>\d+)\/$/u';
var_dump(preg_match($r,'test/3423/',$m), $m);
Previous Comments:
------------------------------------------------------------------------
[2012-04-19 17:07:44] asersz at gmail dot com
Description:
------------
I am not good at english.
A warning: preg_match(): Compilation failed: unknown option bit(s) set at offset
0
OS: MacOSX Lion 10.7.2
Web Server: apache 2
PHP : 5.4.0
PCRE (Perl Compatible Regular Expressions) Support: enabled
PCRE Library Version: 8.02 2010-03-19
By the way: the php 5.4.0 released is stable or not ?
thanks.
Test script:
---------------
<?php
$r='/^(?P\w+)\/(?P\d+)\/$/u';
var_dump(preg_match($r,'test'));
Expected result:
----------------
What does the warning mean ?
The preg_match should be return 0 without warnings.
Actual result:
--------------
Warning: preg_match(): Compilation failed: unknown option bit(s) set at offset 0
in /Users/zhangyowei/Web/lieqee/test.php on line 4
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61775&edit=1