private static function _search($str,$idx) 
    {
        self::_initialize();

        $idx  = $idx == self::PLURAL ? self::SINGULAR : self::PLURAL;
        $vals = self::$_inflections[$idx];

        // adding irregular
        foreach (self::$_inflections[self::IRREGULAR] as $key => $val) {
            $vals[$key] = $val;
            $vals[$val] = $key;
        }

        foreach ($vals as $key => $val) {
            $reg = preg_match('/^\/[\s\S]+\/[imsxeADSUXJu]?$/', $key);
            $exp = $reg ? $key : "/$key/i";
            $mat = preg_match($exp, $str);

            if (!$reg && $mat) {
                return $val;
            }
            if ($reg && $mat) {
                return preg_replace($key, $val, $str);
            }
        }

        // default behaviour - the "s" thing
        return $idx == self::SINGULAR ? trim($str)."s" : preg_replace('/s$/', "", $str);
    }