|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9326 Warning: REG_EPAREN in query when qeuery for "(au" open brackets
Submitted: 2001-02-18 14:19 UTC Modified: 2001-02-18 15:11 UTC
From: webmaster at myjmk dot com Assigned:
Status: Closed Package: Regexps related
PHP Version: 4.0.0 OS: Win98-MSPWS, LINUX-APACHE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
45 - 1 = ?
Subscribe to this entry?

 [2001-02-18 14:19 UTC] webmaster at myjmk dot 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
         $str= ereg_replace("$Eingabewort_lc", "<b>$Eingabewort_lc</b>", $str);
         //Erster Buchstabe wird Gro? gesetzt und getauscht
         $str= ereg_replace("$Eingabewort_uc", "<b>$Eingabewort_uc</b>", $str);
         //ganzer String wird "upper case" gesetzt und getauscht
         $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:

You can check this by simply typing into the field "insert search string"
ths string "(au" or "(fu". 
The URL is

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-18 15:04 UTC]
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 15:11 UTC]
erm, bloody mousewheel.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 01:03:35 2022 UTC