using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"BEGIN:VEVENT.*?END:VEVENT";
string input = @"BEGIN:VEVENT
DTSTAMP:20220301T023567Z
UID: xxx
DTSTART;TZID=Asia/Tokyo:20210630T110000
DTEND;TZID=Asia/Tokyo:20210630T160000
DESCRIPTION:\n--------\n同日入替 : false\n前回ゲスト数 : 1\n次
SUMMARY: xxxxx (xxx / xxx xxx
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20221105T072143Z
UID: xxx
DTSTART;TZID=Asia/Tokyo:20210501T110000
DTEND;TZID=Asia/Tokyo:20210701T160000
DESCRIPTION:\n--------\n同日入替 : false\n前回ゲスト数 : 1\n次
SUMMARY: xxx (xxx / xxx xxx)
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20220905T023143Z
UID: xxx
DTSTART;TZID=Asia/Tokyo:20220227T110000
DTEND;TZID=Asia/Tokyo:20220227T160000
DESCRIPTION:\n--------\n同日入替 : true\n前回ゲスト数 : 2\n次回
SUMMARY:★ xxx (xxx / xxx xxx)
END:VEVENT";
RegexOptions options = RegexOptions.Multiline | RegexOptions.Singleline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx