Possible Duplicate:
Converting ereg expressions to preg
I'm trying to fix some old code so that it works with PHP 5.3. Hopefully the first conversion to str_replace is okay but I'm completely unsure about the second conversion to preg_replace.
Any help would be very much appreciated. Thanks
$this->Query = str_replace(" where "," WHERE ", $this->Query);
$this->Query = str_replace(" select "," SELECT ", $this->Query);
$this->Query = str_replace(" from "," FROM ", $this->Query);
$this->Query = str_replace(" as "," AS ", $this->Query);
// $this->Query = eregi_replace(" WHERE ", " where ", $this->Query);
// $this->Query = eregi_replace("SELECT ", "select ", $this->Query);
// $this->Query = eregi_replace(" FROM ", " from ", $this->Query);
// $this->Query = eregi_replace(" AS ", " as ", $this->Query);
$TempQuery = eregi_replace("^select .* from ", "select count(1) from ", $this->Query);
$TempQuery = eregi_replace(" order by .*$", "", $TempQuery);