我有一个如下的段落:
一些用于测试的用语 [!#today] ,其中 [!condition] 不满足这个措辞 [!ShowElemIf://Student/FullName; [[[Text not recognized fully]]];/名字] 但是找到了年龄为 [!ShowElemIf://Student/Age;xml//Student/DOB/@formatted;y] 的简单标记。
我需要使用C#查找上述所有占位符/标记,例如:[!tag]。我尝试使用正则表达式,但无法找到加粗的"FullName"单词作为标记。
List<string> tags = Regex.Matches(
sampleText.Replace(Environment.NewLine, ""), @"\[!([^]]+)\] ")
.Cast<Match>()
.Select(x => x.Groups[1].Value)
.ToList();
使用这个正则表达式,我可以找到以下内容,但不能找到高亮部分。
- 今天
- 条件
- ShowElemIf://Student/Age;xml//Student/DOB/@formatted;y