Jump to content

User:RoboMaxCyberSem/boxrec

From Wikipedia, the free encyclopedia
        Regex r = new Regex(@"\*\s*\[http://(?:www\.|)boxrec\.com/(?:list_bouts\.php\?human_id=|boxer_display\.php\?boxer_id=)(\d*)(&cat=boxer)? .*?\].*?$", RegexOptions.Compiled | RegexOptions.Multiline);
        
        public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
        {
            string name = Regex.Replace(ArticleTitle, @"\s*\(.*", "");
            string template = "* {{boxrec|id=$1}}";
            if (name != ArticleTitle) template = "* {{boxrec|id=$1|name=" + name + "}}";
            
            string text = r.Replace(ArticleText, template);
            Skip = text == ArticleText;
            Summary = "";
            return text;
        }