Changeset 467

Show
Ignore:
Timestamp:
09/01/2007 05:49:40 PM (15 months ago)
Author:
Geert
Message:

Regex optimization:

  • Removed useless capturing parentheses
  • Character class is faster than alternation with single characters
  • If the string contains 'is not', a check for 'is ' is sufficient already
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Database.php

    r447 r467  
    826826         * @access  private 
    827827         * @param   string 
    828          * @return  bool 
     828         * @return  boolean 
    829829         */ 
    830830        public function _has_operator($str) 
    831831        { 
    832                 return (bool) preg_match('/(\s|<|>|!|=|is |is not)/i', trim($str)); 
     832                return (bool) preg_match('/[\s=<>!]|is /i', trim($str)); 
    833833        } 
    834834