ID: 31576 Updated by: [EMAIL PROTECTED] -Summary: mbregex fails to recognise word boundary markers [[:<:]] on Windows XP Reported By: mw at lanfear dot com -Status: Open +Status: Bogus Bug Type: mbstring related -Operating System: Windows XP SP1 Only +Operating System: irrelevant -PHP Version: 5.0.3 +PHP Version: * New Comment:
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 [[:<:]] [[:>:]] These styles of regular expression are not official part of POSIX standard. http://www.opengroup.org/onlinepubs/009695399/basedefs/ xbd_chap09.html The implementation used in ereg*() is originally extended in some way, probably to use with Tcl. Better use /b and /B instead for more compatibility. Previous Comments: ------------------------------------------------------------------------ [2005-01-16 20:39:47] mw at lanfear dot com Description: ------------ The mbregex compiler appears to have a bug in it via which it cannot compile the word boundary markers [[:<:]] and [[:>:]] on the Windows version of PHP. (IIS5.1, PHP 5.0.3) On the Unix version of PHP, these boundaries work fine, with or without the mbstring and mbregex extension enabled, and the Windows versions of PHP will also recognise these markers IFF the mbstring.dll is disabled. Given the string: $strr "This is an ip address: 192.168.1.1 ..." The following: ereg("[[:<:]][0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[[:>:]]", $strr, $regex); will generate the following error in windows (IIS5.1, PHP 5.0.3), provided mbstring is enabled: Warning: mb_ereg() [function.mb-ereg]: mbregex compile err: invalid POSIX bracket type in c:\Inetpub\wwwroot\regex_test.php on line 5 NULL Reproduce code: --------------- <?php $ipaddrs = "192.168.12.22, then followed by 192.168.1.1"; ereg("[[:<:]][0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[[:>:]]", $ipaddrs, $regex); var_dump($regex); ?> Expected result: ---------------- array(1) { [0]=> string(13) "192.168.12.22" } Actual result: -------------- Warning: mb_ereg() [function.mb-ereg]: mbregex compile err: invalid POSIX bracket type in c:\Inetpub\wwwroot\regex_test.php on line 5 NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31576&edit=1