我需要一些比我更擅长正则表达式的人的帮助:)
我正在尝试使用 .NET (C#) 在字符串中查找特定标记的值
我拥有的字符串有这样的标记{token:one}
我的功能如下:
public static ArrayList GetMatches(string szInput)
{
// Example string
// Lorem ipsum {token:me} lala this {token:other} other stuff
ArrayList aResults = new ArrayList();
string szPattern = @"(\{token:(*)\})";
foreach (Match match in Regex.Matches(szInput, szPattern))
{
aResults.Add(match.Value);
}
// It should contain me and other
return aResults;
}
任何指针都将不胜感激。