PHP 4.0 Bug #8610 Updated: ereg* complains without cause

From: Date: Tue, 09 Jan 2001 09:19:26 +0000
Subject: PHP 4.0 Bug #8610 Updated: ereg* complains without cause
Groups: php.dev 
Request: Send a blank email to php-dev+get-43530@lists.php.net to get a copy of this message
ID: 8610 Updated by: rasmus Reported By: sam@ananova.com Old-Status: Open Status: Closed Bug Type: Regexps related Assigned To: Comments: I don't consider this a bug, and if you still think it is you will need to take it up with Henry Spencer. According to Henry ab| is not valid as per Posix 1003.2. Check out the php4/regex/tests file. He specifically tests for this and says it should return EMPTY. The workaround is to either use (ab|()) or use preg_match() instead. Previous Comments: --------------------------------------------------------------------------- [2001-01-09 03:53:41] sam@ananova.com Corrected bug type --------------------------------------------------------------------------- [2001-01-09 03:51:27] sam@ananova.com if (eregi('^(ab|)c$',$x)) print "blah: $x<br>n"; complains with Warning: REG_EMPTY in /usr/local/ananova_v2/www/search/_index.php on line 31 and returns false regardless of $x yet: echo "c" | egrep '^(ab|)c$' echo "ac" | egrep '^(ab|)c$' echo "abc" | egrep '^(ab|)c$' outputs: c abc Removing the from my php expression | stops the complaint but ruins the pattern. My pattern intends to read (in english) Optionally prefixed by "ab" and matches "c" exactly. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8610

« previous php.dev (#43530) next »