const string input = "===== Action: [Action1] State: [State1] by:[user1] at [timestamp1] ===== [Notes1]===== Action: [Action2] State: [State2] by:[user2] at [timestamp2] ===== [Notes2]";
Regex expression = new Regex(@"===== Action: (?<Action>.*?)State:(?<State>.*?)by:(?<userid>.*?)at(?<timestamp>.*?)=====(?<Note>.*?)");
var results = expression.Matches(input);
foreach (Match match in results)
{
Console.WriteLine("UserId:" + match.Groups["userid"].Value);
Console.WriteLine("Action:" + match.Groups["Action"].Value);
Console.WriteLine("State:" + match.Groups["State"].Value);
Console.WriteLine("TimeStamp:" + match.Groups["timestamp"].Value);
Console.WriteLine("Note:" + match.Groups["Note"].Value);
}
注を除くすべての値を正しく解析できました。私が間違っていたアイデアはありますか?