I am trying to clean up and merge some older calendar files (x.ics), using Sublime Text as editor. Opening the files gives a long file like below. I would like to delete (i.e. replace by nothing) all the entries (VEVENTs) in the file mentioning Birthday in the SUMMARY and keep all other entries, so I am using Regular Expressions as an approach.
I managed to match the lines from BEGIN:VEVENT to END:VEVENT, however I can't manage to setup an expression to filter only the matches/VEVENTs with the Birthdays in it.
What I have now is this expression: BEGIN:VEVENT(.|\n)*?(Birthday)(.|\n)*?END:VEVENT\n
. Clearly this is not the right expression, as it matches from BEGIN till the END just after it found Birthday and doesn't match the single VEVENT.
Can anybody please help me to find a solution? It would be much appreciated!
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:2009
X-WR-TIMEZONE:Europe/Amsterdam
X-WR-CALDESC:
BEGIN:VEVENT
DTSTART:20110606T170500Z
DTEND:20110614T121000Z
DTSTAMP:20140108T203731Z
UID:CSVConvert0127bd7e37d8feb5e1daaa909729c2ba
CREATED:19000101T120000Z
DESCRIPTION:
LAST-MODIFIED:19700101T000000Z
LOCATION:Amsterdam
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Study
TRANSP:OPAQUE
END:VEVENT
.
.
.
BEGIN:VEVENT
DTSTART;VALUE=DATE:20110704
DTEND;VALUE=DATE:20110705
DTSTAMP:20140108T203731Z
UID:CSVConvert02f7a0b537b60e5601035a356dfd6a06
CREATED:19000101T120000Z
DESCRIPTION:
LAST-MODIFIED:19700101T000000Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Mark's Birthday
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR