私よりも正規表現が得意な人からの助けが必要です:)
.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;
}
どんなポインタでも大歓迎です。