我从我的数组字符串中的调试器得到了以下内容:
"/mercedes-benz/190-class/1993/" class="canonicalLink" data-qstring="?sub=sedan">1993
我希望将文本在每个“/”后分割,并将其放入
string[]
中,以下是我的努力:Queue<string> see = new Queue<string>(); //char[] a = {'\n '};
List<car_facts> car_fact_list = new List<car_facts>();
string[] car_detail;
foreach (string s in car)
{
MatchCollection match = Regex.Matches(s, @"<a href=(.+?)</a>",
RegexOptions.IgnoreCase);
// Here we check the Match instance.
foreach(Match mm in match)
{
// Finally, we get the Group value and display it.
string key = mm.Groups[1].Value;
//key.TrimStart('"');
//key.Trim('"');
key.Trim();
// @HERE: I tried with string.Split as well and tried many combinations of separators
car_detail = Regex.Split(key, "//");
see.Enqueue(key);
}
}
在
car_detail[0]
中,我得到了这个"$[link]">$[title]
。
来自这个字符串:
"/mercedes-benz/190-class/1993/" class="canonicalLink" data-qstring="?sub=sedan">1993