1、  pinyinStr=pinyinStr.replace(/\[content\](.|\n)*(?=\[keywords\])/gi,"");匹配以[keywords]结尾,但不包括本身的内容
    pinyinStr='[word]\r\n' +word_eval+ "\r\n" +pinyinStr.replace(/\[content\](.|\n)*(?=\[keywords\])/gi,"");

 

2、var re=/\breplace\s*:\s*.*\b/gi; \b自动识别边界(,、等)
  

3、

.   匹配除换行之外的任何单个字符。

(.|\n)*匹配所有字符

 

4、C#

 string UrlReferrer = context.Request["VspUrlReferrer"].ToString();
                        Regex regex = new Regex(@"(?:http\:\/\/)(.*?)(?:\/)", RegexOptions.IgnoreCase);
                        string hostChrome = regex.Match(UrlReferrer).Groups[1].Value;
                        host = hostChrome;

posted on 2011-12-19 17:04  osccur123  阅读(94)  评论(0)    收藏  举报