String[] myString = yourString.replace("<li>", "").Split(new string[] { "</li>" }, StringSplitOptions.RemoveEmptyEntries);
尝试这个
const string HTML_TAG_PATTERN = "<[^/li]>"; // may require some change
string safeString = Regex.Replace(yourString, HTML_TAG_PATTERN, string.Empty);
String[] myString = safeString.Split(new string[] { "</li>" }, StringSplitOptions.RemoveEmptyEntries);
你也可以试试这个正则表达式
string acceptable = "li";
string stringPattern = @"</?(?(?=" + acceptable + @")notag|[a-zA-Z0-9]+)(?:\s[a-zA-Z0-9\-]+=?(?:(["",']?).*?\1?)?)*\s*/?>";
string yourString= Regex.Replace(yourString, stringPattern, string.Empty);
String[] myString = yourString.replace("<li>", "").Split(new string[] { "</li>" }, StringSplitOptions.RemoveEmptyEntries);