|
@@ -11527,14 +11527,17 @@ FROM
|
|
|
|
|
|
// 构造正则表达式,匹配形如 [++]内容[++] 的部分
|
|
|
string pattern = $@"{Regex.Escape(tag)}(.*?){Regex.Escape(tag)}";
|
|
|
- MatchCollection matches = Regex.Matches(input, pattern);
|
|
|
|
|
|
- foreach (System.Text.RegularExpressions.Match match in matches)
|
|
|
+ // 添加 RegexOptions.Singleline 选项使 . 匹配包括换行符在内的所有字符
|
|
|
+ MatchCollection matches = Regex.Matches(input, pattern, RegexOptions.Singleline);
|
|
|
+
|
|
|
+ string[] strValueArr = new string[1];
|
|
|
+ foreach (Match match in matches)
|
|
|
{
|
|
|
- // 提取匹配的内容(在两个标记之间的部分)
|
|
|
- results.Add(match.Groups[1].Value);
|
|
|
+ var strValue = match.Groups[1].Value;
|
|
|
+ strValueArr = Regex.Split(strValue, @"\r\n|\n");
|
|
|
}
|
|
|
-
|
|
|
+ results.AddRange(strValueArr.Where(x => !string.IsNullOrWhiteSpace(x)));
|
|
|
return results;
|
|
|
}
|
|
|
|