Fixed error when getting matching element after preg_match