Exemple #1
0
        protected override string ProcessContent(string content, object context)
        {
            MatchProcessingReplacer replacer = new MatchProcessingReplacer(@"(?<!\(\s{1,}|\[\s{1,})(?<=\s{1,}|^)(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_=]*)(?<![\.\?\-_\,]|\s{1,})",
                                                                           delegate(Match m, object state) {
                return(String.Format("[{0}]({0})", m.Value));
            }
                                                                           );

            return(replacer.Replace(content, context));
        }
Exemple #2
0
        protected override string ProcessContent(string content, object context)
        {
            MatchProcessingReplacer replacer = new MatchProcessingReplacer(@"(?<=\s{1,}|^)((/r/)(?'sub'[a-zA-Z0-9]+))",
                                                                           delegate(Match m, object state) {
                return(String.Format("[{0}](http://np.reddit.com{0})", m.Value));
            }
                                                                           );

            return(replacer.Replace(content, context));
        }
Exemple #3
0
        protected override string ProcessContent(string content, object context)
        {
            MatchProcessingReplacer replacer = new MatchProcessingReplacer(@"(?<=\s{1,}|^)((/v/)(?'sub'[a-zA-Z0-9]+))",
                                                                           delegate(Match m, object state) {
                var u = new UrlHelper(HttpContext.Current.Request.RequestContext, RouteTable.Routes);
                return(String.Format("[{0}]({0})", u.Action("SubverseIndex", "Subverses", new { subversetoshow = m.Groups["sub"] })));
            }
                                                                           );

            return(replacer.Replace(content, context));
        }
Exemple #4
0
 protected override string ProcessContent(string content, object context)
 {
     MatchProcessingReplacer replacer = new MatchProcessingReplacer(ACCEPTABLE_LEADS + @"((/?v/)(?'sub'[a-zA-Z0-9]+((/(new|top(\?time=(day|week|month|year|all))?|comments/\d+(/\d+(?:/\d+(?:\d+)?)?)?)))?)(?'anchor'#(?:\d+|submissionTop))?)",
        ProcessLogic
     );
     return replacer.Replace(content, context);
 }
Exemple #5
0
 protected override string ProcessContent(string content, object context)
 {
     MatchProcessingReplacer replacer = new MatchProcessingReplacer(ACCEPTABLE_LEADS + @"((/?r/)(?'sub'[a-zA-Z0-9_]+))", ProcessLogic);
     return replacer.Replace(content, context);
 }
Exemple #6
0
 protected override string ProcessContent(string content, object context)
 {
     MatchProcessingReplacer replacer = new MatchProcessingReplacer(ACCEPTABLE_LEADS + @"(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_=!@:]*)(?<![\.\?\-_\,]|\s{1,})",
        ProcessLogic
     );
     return replacer.Replace(content, context);
 }