title: Function eregi() is deprecated
body: <p>Function eregi() is deprecated. How can i replace eregi(). I try with preg_match but then stop working.</p>
  
  <p>i us ethis help:</p>
  
  <p><a href="http://takien.com/513/how-to-fix-function-eregi-is-deprecated-in-php-5-3-0.php" rel="nofollow">http://takien.com/513/how-to-fix-function-eregi-is-deprecated-in-php-5-3-0.php</a></p>
  
  <p>CODE BEFORE:</p>
  
  <pre><code>if ( ! eregi("convert$", $this-&gt;library_path))
          {
              if ( ! eregi("/$", $this-&gt;library_path)) $this-&gt;library_path .= "/";
  
              $this-&gt;library_path .= 'convert';
          }
  
  if (eregi("gd2$", $protocol))
          {
              $protocol = 'image_process_gd';
          }
  </code></pre>
  
  <p>CODE THEN:</p>
  
  <pre><code>if ( ! preg_match("convert$/i", $this-&gt;library_path))
          {
              if ( ! preg_match("/$/i", $this-&gt;library_path)) $this-&gt;library_path .= "/";
  
              $this-&gt;library_path .= 'convert';
          }
  
  if (preg_match("gd2$/i", $protocol))
          {
              $protocol = 'image_process_gd';
          }
  </code></pre>