using System.Text.RegularExpressions;

  • detect a URL: Regex urlregex = new Regex(@"(http:"/"/(["w.]+"/?)"S*)", RegexOptions.IgnoreCase|RegexOptions.Compiled);
    regex for Detecting urls
  • ^((ht|f)tp(s?))"://([0-9a-zA-Z"-]+".)+[a-zA-Z]{2,6}(":[0-9]+)?(/"S*)?$
  • ^(?((?http:"/"/)*(?(www|[^"-"n]*)*)(".)*(?[^"-"n]+)".(?[a-zA-Z]{2,3}[^>"n]*)))$
  • ^(?((?http:"/"/)*(?(www|[^"-"n]*)*)(".)*(?[^"-"n]+)".(?[a-zA-Z]{2,3}[^>"n]*)))$
  • ^[http://www.|www.]["S]+$
  • detect a Email: Regex emailregex = new Regex(@"([a-zA-Z_0-9.-]+"@[a-zA-Z_0-9.-]+"."w+)", RegexOptions.IgnoreCase|RegexOptions.Compiled);
  • posted on 2009-04-29 14:23  蔡春升  阅读(154)  评论(0编辑  收藏  举报