public function performMatch(&$regexArr, $binarySubject)
 {
     $ret = false;
     $outcome = @preg_match($regexArr["regex"], $binarySubject, $matches);
     if ($outcome === false) {
         echo "ERROR: " . ($regexArr["ID"] < 10000 ? "System" : "Custom") . " release regex '" . $regexArr["ID"] . "' is not a valid regex.\n";
         $db = new DB();
         $db->exec(sprintf("update releaseregex set status=0 where ID = %d and status=1", $regexArr["ID"]));
         return $ret;
     }
     if ($outcome) {
         $cat = new Category();
         $matches = array_map("trim", $matches);
         if (isset($matches['reqid']) && (!isset($matches['name']) || empty($matches['name']))) {
             $matches['name'] = $matches['reqid'];
         }
         // Check that the regex provided the correct parameters
         if (!isset($matches['name']) || empty($matches['name'])) {
             //echo "ERROR: Regex applied which didnt return right number of capture groups - '".$regexArr["ID"]."'\n";
             return $ret;
         }
         if (!isset($matches['parts']) || empty($matches['parts'])) {
             $matches['parts'] = "00/00";
         }
         if (isset($matches['name']) && isset($matches['parts'])) {
             if (strpos($matches['parts'], '/') === false) {
                 $matches['parts'] = str_replace(array('-', '~', ' of '), '/', $matches['parts']);
             }
             $regcatid = "null ";
             if ($regexArr["categoryID"] != "") {
                 $regcatid = $regexArr["categoryID"];
             }
             //override
             if ($regcatid == Category::CAT_PC_0DAY) {
                 if ($cat->isMobileAndroid($matches['name'])) {
                     $regcatid = Category::CAT_PC_MOBILEANDROID;
                 }
                 if ($cat->isMobileiOS($matches['name'])) {
                     $regcatid = Category::CAT_PC_MOBILEIOS;
                 }
                 if ($cat->isMobileOther($matches['name'])) {
                     $regcatid = Category::CAT_PC_MOBILEOTHER;
                 }
                 if ($cat->isIso($matches['name'])) {
                     $regcatid = Category::CAT_PC_ISO;
                 }
                 if ($cat->isMac($matches['name'])) {
                     $regcatid = Category::CAT_PC_MAC;
                 }
                 if ($cat->isPcGame($matches['name'])) {
                     $regcatid = Category::CAT_PC_GAMES;
                 }
                 if ($cat->isBookEBook($matches['name'])) {
                     $regcatid = Category::CAT_BOOK_EBOOK;
                 }
             }
             $reqID = "";
             if (isset($matches['reqid'])) {
                 $reqID = $matches['reqid'];
             }
             //check if post is repost
             if (preg_match('/(repost\\d?|re\\-?up)/i', $binarySubject, $repost) && !preg_match('/repost|re\\-?up/i', $matches['name'])) {
                 $matches['name'] .= ' ' . $repost[1];
             }
             $matches['regcatid'] = $regcatid;
             $matches['regexID'] = $regexArr['ID'];
             $matches['reqID'] = $reqID;
             $ret = $matches;
         }
     }
     return $ret;
 }