@guy038 said in .ics file selection problem:
at beginning of my post are totally independent !
Firstly my apologies. I got fixated on the concept of using a positive lookahead after looking at both of your solutions. For some reason later on a did mix them together and thinking there were 2 steps.
Perhaps in my defence I’ve just come to realise my reasoning all the way through was that there would be extraneous lines between the END:VEVENT and BEGIN:VEVENT lines, that is, between the record sets. I’ve just googled a typical ics file and whilst that isn’t true there are additional lines before AND after (header and footer info) the sets we were identifying with the regexes. I’ve got a longish one and reduced the size so you can see what shows in the file.
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:ECML PKDD 2015
X-WR-TIMEZONE:Europe/Lisbon
X-WR-CALDESC:The European Conference on Machine Learning and Principles and
Practice of\nKnowledge Discovery in Databases (ECMLPKDD) will take place i
n Porto\,\nPortugal\, from September 7th to 11th\, 2015 (http://www.ecmlpkd
d2015.org).\n\nThis event is the leading European scientific event on machi
ne learning and\ndata mining and builds upon a very successful series of 25
ECML and 18 PKDD\nconferences\, which have been jointly organized for the
past 14 years.
BEGIN:VTIMEZONE
TZID:Europe/Lisbon
X-LIC-LOCATION:Europe/Lisbon
BEGIN:STANDARD
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
TZNAME:WET
DTSTART:19701025T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
TZNAME:WEST
DTSTART:19700329T010000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTART:20180907T083000Z
...
SUMMARY:Ex. Ep. Especial: IP/PROGI
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20150803
...
SUMMARY:Workshops - Camera Ready
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20150901
...
SUMMARY:Tutorials - Tutorials Material
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
So although the OP never showed this I had made the assumption I couldn’t guarantee there weren’t other lines, nor did I think to ask.
Thanks for critiquing my regexes. I had made a discovery and couldn’t quite believe I hadn’t considered it before. There have been lots of instances where I wanted to find a data set with a specific string using the lookahead and seeing it would continue through other sets UNTIL it found the correct one. The realisation I had the power to stop it upon a failed string search within the 1 data set was (dare I say it) overwhelming. It was like a light had suddenly switched on, learning a new ability with regexes.
Cheers
Terry