app/code/community/Varien/Profiler.php
public static function getLineNumber($file, $regex)
    {
        $i = 0;
        $lineFound = false;
        $handle = @fopen($file, 'r');
        if ($handle) {
            while (($buffer = fgets($handle, 4096)) !== false) {
                $i++;
                if (preg_match($regex, $buffer)) {
                    $lineFound = true;
                    break;
                }
            }
            fclose($handle);
        }
        return $lineFound ? $i : false;
    }
public static function getLineNumber($file, $regex)
    {
        $i = 0;
        $lineFound = false;
        $handle = @fopen($file, 'r');
        if ($handle) {
            while (($buffer = fgets($handle, 4096)) !== false) {
                $i++;
                if (preg_match($regex, $buffer)) {
                    $lineFound = true;
                    break;
                }
            }
            fclose($handle);
        }
        return $lineFound ? $i : false;
    }
public static function getLineNumber ( $ file , $ regex ) { $ i = 0 ; $ lineFound = false ; $ handle = @ fopen ( $ file , 'r' ) ; if ( $ handle ) { while ( ( $ buffer = fgets ( $ handle , 4096 ) ) !== false ) { $ i ++ ; if ( preg_match ( $ regex , $ buffer ) ) { $ lineFound = true ; break ; } } fclose ( $ handle ) ; } return $ lineFound ? $ i : false ; }
Get the line number of the first line in a file matching a given regex
Not the nicest solution, but probably the fastest

@param $file
@param $regex
@return bool|int
Get the line number of the first line in a file matching a given regex Not the nicest solution but probably the fastest