Range out of order in character class

前端 未结 7 1581
广开言路
广开言路 2020-12-07 00:20

I\'m getting this odd error in the preg_match() function:

Warning: preg_match(): Compilation failed: range out of order in character class at offset 54

The l

7条回答
  •  青春惊慌失措
    2020-12-07 01:03

    This is a bug in several versions of PHP, as I have just verified for the current 5.3.5 version, as packaged with XAMPP 1.7.4 on Windows XP home edition.

    Even some very simple examples exhibit the problem, e.g.,

        $pattern = '/^[\w_-. ]+$/';
        $uid = 'guest';
        if (preg_match($pattern, $uid)) echo 
          ("");
    

    The PHP folks have known about the bug since 1/10/2010. See http://pear.php.net/bugs/bug.php?id=18182. The bug is marked "closed" yet persists.

提交回复
热议问题