1 public string GetRegValue(string HtmlCode, string RegexString, string GroupKey, bool RightToLeft)
2 {
3 MatchCollection m;
4 Regex r;
5 if (RightToLeft == true)
6 {
7 r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.RightToLeft);
8 }
9 else
10 {
11 r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline);
12 }
13 m = r.Matches(HtmlCode);
14 string[] MatchValue = new string[m.Count];
15 for (int i = 0; i < m.Count; i++)
16 {
17 MatchValue[i] = m[i].Groups[GroupKey].Value;
18 }
19 if (MatchValue.Length > 0)
20 {
21 return MatchValue[0].ToString().Trim();
22 }
23 else
24 {
25 return "";
26 }
27 }
28 public string SniffwebCodeReturnList(string code, string wordsBegin, string wordsEnd)
29 {
30 try
31 {
32 ArrayList urlList = new ArrayList();
33 //string NewsTitle = "";
34 Regex regex1 = new Regex("" + wordsBegin + @"(?<title>[\s\S]+?)" + wordsEnd + "", RegexOptions.Compiled | RegexOptions.IgnoreCase);
35 for (Match match1 = regex1.Match(code); match1.Success; match1 = match1.NextMatch())
36 {
37 urlList.Add(match1.Groups["title"].ToString());
38 }
39 if (urlList.Count > 0)
40 {
41 return urlList[0].ToString();
42 }
43 else
44 {
45 return "";
46 }
47
48 }
49 catch
50 {
51 return "";
52
53 }
54
55 }
2 {
3 MatchCollection m;
4 Regex r;
5 if (RightToLeft == true)
6 {
7 r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.RightToLeft);
8 }
9 else
10 {
11 r = new Regex(RegexString, RegexOptions.IgnoreCase | RegexOptions.Singleline);
12 }
13 m = r.Matches(HtmlCode);
14 string[] MatchValue = new string[m.Count];
15 for (int i = 0; i < m.Count; i++)
16 {
17 MatchValue[i] = m[i].Groups[GroupKey].Value;
18 }
19 if (MatchValue.Length > 0)
20 {
21 return MatchValue[0].ToString().Trim();
22 }
23 else
24 {
25 return "";
26 }
27 }
28 public string SniffwebCodeReturnList(string code, string wordsBegin, string wordsEnd)
29 {
30 try
31 {
32 ArrayList urlList = new ArrayList();
33 //string NewsTitle = "";
34 Regex regex1 = new Regex("" + wordsBegin + @"(?<title>[\s\S]+?)" + wordsEnd + "", RegexOptions.Compiled | RegexOptions.IgnoreCase);
35 for (Match match1 = regex1.Match(code); match1.Success; match1 = match1.NextMatch())
36 {
37 urlList.Add(match1.Groups["title"].ToString());
38 }
39 if (urlList.Count > 0)
40 {
41 return urlList[0].ToString();
42 }
43 else
44 {
45 return "";
46 }
47
48 }
49 catch
50 {
51 return "";
52
53 }
54
55 }