Edit report at http://bugs.php.net/bug.php?id=51438&edit=1
ID: 51438 Comment by: abca_b_cabcom at hotmail dot com Reported by: abca_b_cabcom at hotmail dot com Summary: First arg of preg_match() Status: Bogus Type: Bug Package: Regexps related Operating System: Windows 7 PHP Version: 5.3.2 New Comment: Yeah got you, johannes, thx Sorry, it is now a bug for both case, but looks strange for the protocol of regex. Previous Comments: ------------------------------------------------------------------------ [2010-03-30 14:14:02] johan...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php echo "/^(([A-Z][a-z]*)+[\\])*([A-Z][a-z]*)+$/"; And see what you pass to the regexp engine. You're using " so \\] becomes \] which escapes the ] ... ------------------------------------------------------------------------ [2010-03-30 14:01:53] abca_b_cabcom at hotmail dot com Description: ------------ The regexs for preg_match() are suppose to work, but error occur Test script: --------------- //test1.php echo preg_match("/^(([A-Z][a-z]*)+\\)*([A-Z][a-z]*)+$/", 'Plz\TestMe'); //test2.php echo preg_match("/^(([A-Z][a-z]*)+[\\])*([A-Z][a-z]*)+$/", 'Plz\TestMe'); Expected result: ---------------- //test1.php - expected result 1 //test2.php - expected result 1 Actual result: -------------- //test1.php - actual result Warning: preg_match() [function.preg-match]: Compilation failed: missing ) at offset 34 in path\to\test.php on line 3 //test2.php - actual result 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51438&edit=1