PHP 4.0 Bug #9326 Updated: Warning: REG_EPAREN in query when qeuery for "(au" open brackets

From: Date: Sun, 18 Feb 2001 20:11:26 +0000
Subject: PHP 4.0 Bug #9326 Updated: Warning: REG_EPAREN in query when qeuery for "(au" open brackets
Groups: php.dev 
Request: Send a blank email to php-dev+get-46852@lists.php.net to get a copy of this message
ID: 9326 Updated by: chrisv Reported By: webmaster@myjmk.com Status: Closed Old-Bug Type: Variables related Bug Type: Regexps related Assigned To: Comments: erm, bloody mousewheel. Previous Comments: --------------------------------------------------------------------------- [2001-02-18 15:04:49] chrisv@php.net First off, you might want to try upgrading PHP. Current release is 4.0.4pl1 and 4.0.5 is in development. As for the error, try escaping the string. '(' is a special character in regular expressions meaning to begin a group of characters for use in a backreference. Something to the effect of: preg_replace("/\(/", "\(", $str) though you'll want to test that before actually using it. --------------------------------------------------------------------------- [2001-02-18 14:19:36] webmaster@myjmk.com I'm using the following binary version of php4 PHP 4.0 Release Candidate 1 - Win32 Distribution I'm using the following function for "highlighting" the query string in a query result string function highlightstring ($str) { global $Eingabewort; //ganzer String wird "lower case" gesetzt und getauscht $Eingabewort_lc=strtolower($Eingabewort); $str= ereg_replace("$Eingabewort_lc", "<b>$Eingabewort_lc</b>", $str); //Erster Buchstabe wird Groß gesetzt und getauscht $Eingabewort_uc=ucfirst($Eingabewort); $str= ereg_replace("$Eingabewort_uc", "<b>$Eingabewort_uc</b>", $str); //ganzer String wird "upper case" gesetzt und getauscht $Eingabestring_uc=strtoupper($Eingabewort); $str= ereg_replace("$Eingabestring_uc", "<b>$Eingabestring_uc</b>", $str); return $str; } When I'm querying for a open bracket "(" the result is a warning: Warning: REG_EPAREN You can check this by simply typing into the field "insert search string" ths string "(au" or "(fu". The URL is www.myjmk.com The same error occurs with using just the bracket "(". But I fixed this exception. This error seems to occur ramdomly. If I'm not using the function above the query works fine, so it must be a problem of the "ereg_replace" function. thanks for your help Jan Kunberger --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9326&edit=2

« previous php.dev (#46852) next »