title: Help converting PHP eregi to preg_match
body: <p>I am wondering if someone could please help me convert a piece of PHP code that is now deprecated.</p>
  
  <p>Here is the single line I am trying to convert:</p>
  
  <pre><code>if(eregi(trim ($request_url_handler[$x]),$this-&gt;sys_request_url) &amp;&amp; $this-&gt;id_found == 0){
  </code></pre>
  
  <p>It is part of a function that return the configuration settings for a website. Below is the whole function.</p>
  
  <pre><code>// GET CORRECT CONFIG FROM DATABASE
  function get_config($db)
  {
      global $tbl_prefix;
      $db-&gt;query("SELECT cid,urls FROM ".$tbl_prefix."sys_config ORDER BY cid");
  
      while($db-&gt;next_record()){
          $request_url_handler = explode("\n",$db-&gt;f("urls"));
          if(empty($request_url_handler[0])) {
              $request_url_handler[0] = "@";
              $this-&gt;id_found = 2;
          }
  
          for($x=0; $x&lt;count($request_url_handler); $x++) {
              if(empty($request_url_handler[$x])) {
                  $request_url_handler[$x] = "@";
              }
              if(eregi(trim($request_url_handler[$x]),$this-&gt;sys_request_url) &amp;&amp; $this-&gt;id_found == 0) {
                  $this-&gt;set_config($db,$db-&gt;f("cid"));
                  $this-&gt;id_found = 1;
              }
          }
  
          if($this-&gt;id_found == 1) {
              return($this-&gt;sys_config_vars);
          }
      }
  
      $this-&gt;set_config($db,"");
      return($this-&gt;sys_config_vars);
  }
  </code></pre>
  
  <p>Any help would be great ly appreciated. I only found the the eregi function was deprecated since I updated XAMPP to 1.7.3.</p>