阵列我有一个像分割字符串从文本和HTML标记
string html = "truongpm<b><i>bold italic</i></b><b>bold</b><i>italic</i>";
字符串我如何获得阵列状
a[0] = "truongpm", a[1]= "<b><i>bold</i></b>", a[2]="<b>bold</b>", a[3]="<i>italic</i>"
从这个字符串。现在我用这个代码
string tagRegex = @"<\s*([^ >]+)[^>]*>.*?<\s*/\s*\1\s*>";
MatchCollection matchesImgSrc = Regex.Matches(html, tagRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
foreach (Match m in matchesImgSrc)
,但它只是让
a[0]= "<b><i>bold</i></b>", a[1]="<b>bold</b>", a[2]="<i>italic</i>"
没有 “truongpm” 请帮帮我! 感谢
在当前模式之前放置'[^ <>] + |'。 – Jerry 2015-03-19 07:48:03