<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[.ics file selection problem]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I’m wandered is it possible in Notepad++ to select (and copy) all segments form iCalendar files that have defined string in SUMMARY: section. The selection would be from BEGIN:VEVENT to END:VEVENT<br />
I must extract important dates from many .ics. I tried to make a macro, but this language is for me not clear as I’m not a programmer at all. I made only a scheme to color BEGIN, END and SUMMARY.<br />
Maybe someone tried to solve a similar problem.<br />
example</p>
<pre><code>...
BEGIN:VEVENT
DTSTART:20201002T133000
DTEND:20201002T150000
DTSTAMP:20201002T133000
UID:880985+880986+880987+880988+880989+880990
CLASS:PUBLIC
DESCRIPTION:Sala: 
LOCATION:(A 123) 50.079202,19.866041
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:bla bla bla
TRANSP:OPAQUE
COLOR:#34B41F
INTERNALID:880985+880986+880987+880988+880989+880990
END:VEVENT
...
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/topic/20072/ics-file-selection-problem</link><generator>RSS for Node</generator><lastBuildDate>Fri, 16 Oct 2026 13:08:41 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20072.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Sep 2020 19:52:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to .ics file selection problem on Thu, 01 Oct 2020 19:24:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said in <a href="/post/58092">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">at beginning of my post are totally independent !</p>
</blockquote>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<pre><code>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
</code></pre>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<p dir="auto">Cheers<br />
Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58113</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58113</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 01 Oct 2020 19:24:03 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Thu, 01 Oct 2020 11:30:30 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-r">@<bdi>Terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">In <a href="https://community.notepad-plus-plus.org/post/58079">this</a> post, you said :</p>
<blockquote>
<p dir="auto">I wondered if a slight alteration might allow the whole process to be carried out with 1 regex</p>
</blockquote>
<p dir="auto">I’m sorry but the <strong>two</strong> solutions given, at <strong>beginning</strong> of <a href="https://community.notepad-plus-plus.org/post/58035">my</a> post are totally <strong>independent</strong> ! So to solve the <a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: marcin-jewiarz">@<bdi>marcin-jewiarz</bdi></a> problem, you need to run :</p>
<ul>
<li>The <strong>first</strong> <strong>Mark</strong> regex , with the <strong><code>Bookmark line</code></strong> option <strong>ticked</strong>, then use the <strong><code>Search &gt; Bookmark &gt; Remove Unmarked Lines</code></strong></li>
</ul>
<p dir="auto">OR</p>
<ul>
<li>The <strong>second</strong> regex S/R ,<strong>only</strong></li>
</ul>
<p dir="auto">So, we do <strong>not</strong> have to try to <strong>mix</strong> them up ;-))</p>
<hr />
<p dir="auto">Then you asked my <strong>opinion</strong> about <strong>your</strong> regex :</p>
<p dir="auto"><strong><code>(?s-i)BEGIN:VEVENT\R((?=SUMMARY:\Qbla bla bla\E).|(?!SUMMARY|BEGIN:).)+?END:VEVENT\R?</code></strong></p>
<p dir="auto">Well, just look at the <strong>second</strong> alternative <strong><code>(?!SUMMARY|BEGIN:).</code></strong>. This regex means that, between the expression <strong><code>BEGIN:VEVENT\R</code></strong> and <strong><code>END:VEVENT\R?</code></strong>, it should <strong>never</strong> occur the expression <strong><code>SUMMARY</code></strong> or <strong><code>BEGIN:</code></strong> at <strong>any</strong> location !</p>
<p dir="auto">So, with <strong>this</strong> regex, between the expressions <strong><code>BEGIN:VEVENT\R(</code></strong> and <strong><code>END:VEVENT\R?</code></strong></p>
<ul>
<li>
<p dir="auto">When the regex engine is at <strong>any</strong> location, of the block, <strong>different</strong> from the <strong>beginning</strong> of a possible line <strong><code>SUMMARY:bla bla bla</code></strong>, this <strong>second</strong> alternative matches and catches the <strong>single</strong> character <strong><code>.</code></strong></p>
</li>
<li>
<p dir="auto">When the regex engine is, <strong>exactly</strong> at the <strong>beginning</strong> of a line <strong><code>SUMMARY:bla bla bla</code></strong>, the <strong>first</strong> alternative <strong><code>(?=SUMMARY:\Qbla bla bla\E).</code></strong> does match and catches the <strong>single</strong> character <strong><code>.</code></strong>, too !</p>
</li>
</ul>
<p dir="auto">So, in short, it matches <strong>any</strong> char of <strong>all</strong> blocks containing the expression <strong><code>SUMMARY:bla bla bla</code></strong></p>
<p dir="auto">Now let’s imagine that you <strong>slightly</strong> change your regex as below :</p>
<p dir="auto"><strong><code>(?s-i)BEGIN:VEVENT\R((?=SUMMARY:\Qbla bla bla\E).|(?!SUMMARY:\Qbla bla bla\E|BEGIN:).)+?END:VEVENT\R?</code></strong></p>
<p dir="auto">This time, the <strong>two</strong> alternatives are totally <strong>exclusive</strong>, regarding the <strong><code>SUMMARY:bla bla bla</code></strong> string ! So the <strong>whole</strong> regex just matches <strong>any</strong> multi-lines block <strong><code>BEGIN:VEVENT.........END:VEVENT</code></strong> !</p>
<hr />
<p dir="auto">Now, in your <a href="https://community.notepad-plus-plus.org/post/58082">last</a> post, you said :</p>
<blockquote>
<p dir="auto">Further testing has given me another revised regex, shorter than before</p>
</blockquote>
<p dir="auto">As your <strong>final</strong> regex does <strong>not</strong> contain the alternative <strong><code>BEGIN:</code></strong>, in the <strong>negative look-head</strong> ! I <strong>support</strong> this point ;-)) Indeed, looking <strong>back</strong> to my <strong>second</strong> solution, this part is <strong>not</strong> needed ! I certainly needed this part, at one moment, during my tests, but it seems <strong>useless</strong> in my final try ;-))</p>
<p dir="auto">So, in summary, the <strong>two</strong> solutions of my <strong>previous</strong> post should be <strong>updated</strong>, without the <strong>free-spacing</strong> mode, as below :</p>
<ul>
<li>
<p dir="auto"><strong>First</strong> solution :</p>
<ul>
<li>
<p dir="auto">Use the <strong>Mark</strong> regex <strong><code>(?s-i)BEGIN:VEVENT((?!BEGIN:).)*?\Qbla bla bla\E.*?END:VEVENT\R?</code></strong>    with the <strong><code>Bookmark line</code></strong> <strong>ticked</strong></p>
</li>
<li>
<p dir="auto">Then, run the <strong>menu</strong> option <strong><code>Search &gt; Bookmark &gt; Remove Unmarked Lines</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Second</strong> solution :</p>
<ul>
<li>
<p dir="auto">Use the <strong>regex</strong> S/R, below, with a <strong>negative look-ahead</strong> :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i)BEGIN:VEVENT\R((?!SUMMARY:\Qbla bla bla\E).)+?END:VEVENT\R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p dir="auto"><strong>Remark</strong> : In the <strong>first</strong> solution, we <strong>still</strong> need to the regex <strong><code>((?!BEGIN:).)*?</code></strong> instead of the <strong><code>.+?</code></strong> one, to <strong>restrict</strong> the match to a <strong>single</strong> block. Indeed, the simple regex <strong><code>.*?</code></strong> can match a line <strong><code>END:VEVENT</code></strong> and the line <strong><code>BEGIN:VEVENT</code></strong> of the <strong>next</strong> block !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">I’ve verified that my <strong>updated second</strong> solution <strong>does</strong> match, as expected, a <strong><code>BEGIN:VEVENT....END:VEVENT</code></strong> block, which does <strong>not</strong> contain any line <strong><code>SUMMARY:........</code></strong> like :</p>
<pre><code class="language-diff">BEGIN:VEVENT
...
...
END:VEVENT
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/58092</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58092</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 01 Oct 2020 11:30:30 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Thu, 01 Oct 2020 01:11:31 GMT]]></title><description><![CDATA[<p dir="auto">Further testing has given me another revised regex, shorter than before.</p>
<p dir="auto">I think this one is very easy to understand and could serve as the final solution.</p>
<p dir="auto"><code>(?s-i)BEGIN:VEVENT\R((?=SUMMARY:\Qbla bla bla\E).|(?!SUMMARY:).)+?END:VEVENT\R?</code></p>
<ol>
<li>We want a set that contains the BEGIN and END lines and contains `SUMMARY:bla bla bla’.</li>
<li>If step 1 fails the alternation says we CANNOT have a line with SUMMARY in it within these boundaries. As that WILL fail (unless no SUMMARY line at all) then the regex fails and thus non <code>bla bla bla</code> record sets are NOT bookmarked.</li>
</ol>
<p dir="auto">So the proviso is the record set MUST contain valid start and end points, i.e. BEGIN:VEVENT and END:VEVENT (which we have always assumed throughout these posts) and it MUST contain a line starting with <code>SUMMARY:</code>.Depending on what is between the <code>\Q</code> and <code>\E</code> points in the regex determines which record sets are marked and which are NOT.</p>
<p dir="auto">At this point I think I’ve spent enough time on it, my curiosity is now satiated.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58082</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58082</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 01 Oct 2020 01:11:31 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Thu, 01 Oct 2020 00:21:27 GMT]]></title><description><![CDATA[<p dir="auto">To all who are interested in my synopsis:</p>
<p dir="auto">I actually fell onto this quite by chance. I’d edited <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>  regex to try the positive lookahead again. My regex was picking up all the BEGIN:VEVENT…END:VEVENT sets again. On a whim I added in the ?!SUMMARY in front of the ?!BEGIN as an alternation and suddenly it seemed to work. Several tests later it was still working.</p>
<p dir="auto">I’ve now been pulling my regex apart trying to better understand HOW it works, I suppose not quite believing it. It does seem contrary to both have a positive lookahead and then also a negative using the same characters. So if I understand it correctly:</p>
<ol>
<li>We start processing a record set starting with the BEGIN:VEVENT</li>
<li>Several lines later we approach the SUMMARY line where we want to find the <code>bla bla bla</code> string. This is the lookahead.</li>
<li>For a record set not containing <code>bla bla bla</code> we fail this positive lookahead <code>(?=SUMMARY:\Qbla bla bla\E)</code>.</li>
<li>As step 3 failed we use the alternation option. At this point it becomes a bit difficult to understand. As alternation works from left to right we first assert we don’t want <code>SUMMARY</code>. As we do currently have this we immediately fail this side of the alternation, so to the right side we assert we don’t want <code>BEGIN:</code>, we don’t and here I would have thought it would continue, but it appears to fail. At least that record set is NOT bookmarked and we start all over again. Actually a glimmer of light. Is it because once we commence moving into the <code>SUMMARY</code> line (so the ?!BEGIN actually was true to start with) the positive lookahead will always fail so we only use the alternation. And in the alternation option <code>?!SUMMARY</code> also always fails, so we are ONLY using the <code>?!BEGIN</code> as the method of stopping, and that eventually fails us as well, hence the regex fails. Thus the regex won’t bookmark a non <code>bla bla bla</code> set.</li>
</ol>
<p dir="auto">Whew, have I actually understood it!</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58081</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58081</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 01 Oct 2020 00:21:27 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Wed, 30 Sep 2020 22:21:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said in <a href="/post/58035">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">We may solve the problem in a more simple way</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> as your 2nd regex (which removes the non “bla bla bla” record sets) intrigued me I wondered if a slight alteration might allow the whole process to be carried out with 1 regex. So do a (book)mark with a single regex, then use the “remove unmarked line”.</p>
<p dir="auto">I think I may have cracked it. I’m still a bit hesitant to put it forward as a solution as it’s quite complicated and dare I say it, not something I’d expect anybody to readily adapt to any future need. It was really just an exercise to satisfy my curiosity.</p>
<p dir="auto">So the regex is:<br />
<code>(?s-i)BEGIN:VEVENT\R((?=SUMMARY:\Qbla bla bla\E).|(?!SUMMARY|BEGIN:).)+?END:VEVENT\R?</code><br />
By bookmarking we will have after running this regex all record sets we want to keep. So we’re back with the positive look-ahead (at least in part) which allows us to remove all the extraneous data not of the BEGIN:VEVENT…END:VEVENT type and the non “bla bla bla” sets in one step.</p>
<p dir="auto">I’d value your input on the validity of this. It appears to work on some demo data which includes some without the “bla bla bla” text so from that point of view it is a success.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58079</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58079</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Wed, 30 Sep 2020 22:21:34 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Wed, 30 Sep 2020 00:10:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said in <a href="/post/58035">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">We may solve the problem in a more simple way</p>
</blockquote>
<p dir="auto">I like it very much. Your were probably seeing the issue I had trying to LOOK for the bla bla bla, rather than your idea is we should look for any that DON’T have the bla bla bla in them, hence the negative lookahead.</p>
<p dir="auto">Might I just add 2 sentences for the benefit of <a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: Marcin-Jewiarz">@<bdi>Marcin-Jewiarz</bdi></a>, just in case he didn’t notice.</p>
<ol>
<li>When you say to use the “Mark” regex (First solution) you forgot to mention the requirement to tick the “bookmark lines”. Obviously without it there are no lines bookmarked and the next step will therefore remove ALL lines.</li>
<li>Use of the <code>(?xs-i)</code>, the <code>x</code> option denotes the following as being of a “free form nature”. The spaces shown are NOT used, but exist ONLY to make it easier to read. This along with the <code>\Q</code> and <code>\E</code> regex functions aren’t used much, but perhaps should be, especially when OP’s come to us with words like “bla bla bla” and we have to say insert your text in this position, however without knowing what the actual text is, it can sometimes cause issues when one or more is actually a metacharacter.</li>
</ol>
<p dir="auto">Cheers<br />
Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58057</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58057</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Wed, 30 Sep 2020 00:10:03 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Thu, 01 Oct 2020 11:34:52 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: marcin-jewiarz">@<bdi>marcin-jewiarz</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-r">@<bdi>Terry-r</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">We may solve the problem in a <strong>more simple</strong> way, with these <strong>two</strong> other solutions :</p>
<ul>
<li>
<p dir="auto"><strong>First</strong> solution :</p>
<ul>
<li>
<p dir="auto">Use the <strong>Mark</strong> regex <strong><code>(?xs-i)  BEGIN:VEVENT  ((?!BEGIN:).)*?  \Qbla bla bla\E  .*?  END:VEVENT\R?</code></strong></p>
</li>
<li>
<p dir="auto">Then, run the <strong>menu</strong> option <strong><code>Search &gt; Bookmark &gt; Remove Unmarked Lines</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Second</strong> solution :</p>
<ul>
<li>
<p dir="auto">Use the regex S/R, below, with a <strong>negative look-ahead</strong> :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?xs-i)  BEGIN:VEVENT  \R  ((?!BEGIN:|SUMMARY:\Qbla bla bla\E).)+?  END:VEVENT  \R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p dir="auto">See an <strong>updated</strong> version of these <strong>regexes</strong> at the <strong>end</strong> of this post :</p>
<p dir="auto"><a href="https://community.notepad-plus-plus.org/post/58092">https://community.notepad-plus-plus.org/post/58092</a></p>
<p dir="auto">For instance, given this text :</p>
<pre><code class="language-diff">BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
   SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
               SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
</code></pre>
<p dir="auto">After running this S/R, we get our <strong>expected</strong> results :</p>
<pre><code class="language-diff">BEGIN:VEVENT
...
   SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
</code></pre>
<hr />
<p dir="auto">We may use the <strong>negative look-ahead</strong> feature , of the <strong>second</strong> regex, to <strong>force</strong> conditions on <strong>several</strong> lines, too ! For instance, let’s suppose that <strong>each</strong> <strong><code>BEGIN:........END:</code></strong> block contains :</p>
<ul>
<li>
<p dir="auto">A line containing <strong><code>Line_&lt;Letter&gt;</code></strong> and that you want to <strong>keep</strong> the lines <strong><code>Line_A</code></strong>, <strong><code>Line_B</code></strong> and <strong><code>Line_C</code></strong>, <strong>only</strong></p>
</li>
<li>
<p dir="auto">A line containing <strong><code>Expression&lt;Letter&gt;</code></strong> and that you want to <strong>keep</strong> the lines <strong><code>Expression_X</code></strong>, <strong><code>Expression_Y</code></strong> and <strong><code>Expression_Z</code></strong>, <strong>only</strong></p>
</li>
</ul>
<p dir="auto">Then, given this sample :</p>
<pre><code class="language-diff">BEGIN:
...
Line_C
...
test    Expression_X
...
END:
BEGIN:
...
Expression_PTEST
...
    Line_B
...
END:
     BEGIN:
...
Line_E
...
Expression_X
...
END:
BEGIN:
...
Expression_M
...
  Line_ATEST
...
     END:
BEGIN:
...
Line_B   Expression_H
...
...
END:
    BEGIN:
...
Expression_X
...
    Line_K
...
     END:
BEGIN:
...
Line_C
...
test    Expression_U
...
   END:
BEGIN:
...
Test   Line_E
...
Expression_Q
...
END:
BEGIN:
...
   Expression_X
...
TEST_Line_A
...
    END:
    BEGIN:
...
Expression_Y_TEST
...
   Line_E
...
END:
   BEGIN:
...
Line_A
...
   __Expression_Y__
...
    END:
BEGIN:
...
    TESTLine_M_TEST_Expression_ZTest
...
END:
BEGIN:
...
123456789Expression_Y
...
Line_B_OK
...
END:
BEGIN:
...
Line_MTEST
...
   Expression_J
...
END:
     BEGIN:
...
Expression_H   Line_L
...
END:
BEGIN:
...
Expression_Z
...
    Line_G
...
      END:
</code></pre>
<p dir="auto">The following <strong>regex</strong> S/R <strong>deletes</strong> any block which does <strong>not</strong> contain the expression <strong><code>Line_A</code></strong>, <strong><code>Line_B</code></strong> or <strong><code>Line_C</code></strong> :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?xs-i)  ^\h*  BEGIN:  ((?!BEGIN:|Line_A|Line_B|Line_C).)+?  END:  .*?$  \R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
<p dir="auto">We get :</p>
<pre><code class="language-diff">Line_C
...
test    Expression_X
...
END:
BEGIN:
...
Expression_PTEST
...
    Line_B
...
END:
BEGIN:
...
Expression_M
...
  Line_ATEST
...
     END:
BEGIN:
...
Line_B   Expression_H
...
...
END:
BEGIN:
...
Line_C
...
test    Expression_U
...
   END:
BEGIN:
...
   Expression_X
...
TEST_Line_A
...
    END:
   BEGIN:
...
Line_A
...
   __Expression_Y__
...
    END:
BEGIN:
...
123456789Expression_Y
...
Line_B_OK
...
END:
</code></pre>
<hr />
<p dir="auto">This last <strong>regex</strong> S/R <strong>deletes</strong> any block which does <strong>not</strong> contain the expression <strong><code>Expression_X</code></strong>, <strong><code>Expression_Y</code></strong> or <strong><code>Expression_Z</code></strong> :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?xs-i)  ^\h*  BEGIN:  ((?!BEGIN:|Expression_X|Expression_Y|Expression_Z).)+?  END:  .*?$  \R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
<p dir="auto">Nice ! Now, each <strong>remaining</strong> block, below, have, <strong>both</strong> :</p>
<ul>
<li>
<p dir="auto">A line containing <strong><code>Line_A</code></strong>, <strong><code>Line_B</code></strong> or <strong><code>Line_C</code></strong></p>
</li>
<li>
<p dir="auto">A line containing <strong><code>Expression_X</code></strong>, <strong><code>Expression_Y</code></strong> or <strong><code>Expression_Z</code></strong></p>
</li>
</ul>
<pre><code class="language-diff">Line_C
...
test    Expression_X
...
END:
BEGIN:
...
   Expression_X
...
TEST_Line_A
...
    END:
   BEGIN:
...
Line_A
...
   __Expression_Y__
...
    END:
BEGIN:
...
123456789Expression_Y
...
Line_B_OK
...
     END:
</code></pre>
<hr />
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The strings <strong><code>BEGIN:</code></strong> and <strong><code>END:</code></strong> may be <strong>preceded</strong> by some <strong>blank</strong> characters</p>
</li>
<li>
<p dir="auto">You may <strong>add</strong> characters <strong>after</strong> the strings <strong><code>BEGIN:</code></strong> and <strong><code>END:</code></strong></p>
</li>
<li>
<p dir="auto">The expressions to <strong>exclude</strong> may occur at <strong>any</strong> location, within a <strong>block</strong></p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58035</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58035</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 01 Oct 2020 11:34:52 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 21:54:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/58024">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">(?i-s)SUMMARY.+?\Qbla bla bla\E</p>
</blockquote>
<p dir="auto">Thank You a lot. This is great, for sure I’ll try to learn more about RegEx, the second time during the week I’ve used it.<br />
The first was a simple code found in one of the communities to extract important data form service register form laboratory equipment. Now, this.  I can make a macro and use it to other files, with modifications to differentr <code>SUMMARY:</code> parameters<br />
Once again Thank You <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58025</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58025</guid><dc:creator><![CDATA[Marcin Jewiarz]]></dc:creator><pubDate>Mon, 28 Sep 2020 21:54:49 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 21:30:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: Marcin-Jewiarz">@<bdi>Marcin-Jewiarz</bdi></a> said in <a href="/post/58019">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">If it would be tuned to find in this block SUMMARY: bla bla bla this would be more than enought</p>
</blockquote>
<p dir="auto">So my steps to be performed on the data already extracted is:</p>
<ol>
<li>Convert each “record set” into 1 line</li>
<li>Mark those lines with “bla bla bla” in them</li>
<li>Remove non-marked lines</li>
<li>Convert the single line records back to normal</li>
</ol>
<p dir="auto">1: We will be using the Replace function.<br />
Find What:<code>(?s)\R(?!BEGIN)</code><br />
Replace With:<code>@#@</code><br />
Search Mode must be regular expression and have wrap around ticked. Click on the “Replace All” button. All records sets should now be in single lines.</p>
<p dir="auto">2: Using the Mark function we have<br />
Find What:<code>(?i-s)SUMMARY.+?\Qbla bla bla\E</code><br />
Have “bookmark lines” ticked. Replace the <code>bla bla bla</code> in the line above with the “literal” text you want to look for. You will see it is encapsulated within the <code>\Q</code> and <code>\E</code> metacharacters. This enables you to safely have any character within this area and not worry that some might have special meaning within the regex environment. Click on the "Mark All’ button. Close window once completed, some lines should be marked.</p>
<p dir="auto">3: Under Search, Bookmark, use the “Remove unmarked Lines”. So at this point ONLY those with “bla bla bla” should remain.</p>
<p dir="auto">4: return the lines to normal. Use the Replace function<br />
Find What:<code>@#@</code><br />
Replace With:<code>\r\n</code><br />
All sections of each record set should be on their own line now.</p>
<p dir="auto">I hope this helps.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58024</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58024</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 28 Sep 2020 21:30:34 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:44:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/58021">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">Have I interpreted correctly: given the data in my t</p>
</blockquote>
<p dir="auto">Yes that’s what I’m looking for.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58023</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58023</guid><dc:creator><![CDATA[Marcin Jewiarz]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:44:22 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:44:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: Marcin-Jewiarz">@<bdi>Marcin-Jewiarz</bdi></a></p>
<p dir="auto">You also didn’t answer my question about whether <code>;ENCODING=...</code> can modify the <code>SUMMARY</code> or not.  Well, it can in general, but whether it can be in your example data or not.</p>
<p dir="auto">And the long form of my advice follows, since it hasn’t been in this thread yet:</p>
<p dir="auto">-—</p>
<p dir="auto"><em>Do you want regex search/replace help?  Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you.  All example text should be marked as plain text using the <code>&lt;/&gt;</code> toolbar button or manual <a href="https://community.notepad-plus-plus.org/topic/14262/how-to-markdown-code-on-this-forum/4">Markdown syntax</a>. Screenshots can be pasted from the clipboard to your post using <code>Ctrl+V</code> to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have <strong>and</strong> the text you want to get from that data; include examples of things that <strong>should match</strong> and be transformed, <strong>and</strong> things that <strong>don’t match</strong> and should be left alone; show <strong>edge cases</strong> and make sure you examples are as <strong>varied</strong> as your real data.  Show the regex you already tried, <strong>and why</strong> you thought it should work; tell us what’s wrong with what you <strong>do</strong> get… Read the official <a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">NPP Searching / Regex docs</a> and the forum’s <a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation">Regular Expression FAQ</a>. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.</em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/58022</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58022</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:44:13 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:42:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: Marcin-Jewiarz">@<bdi>Marcin-Jewiarz</bdi></a> ,</p>
<p dir="auto">This is one of the many times when my standard advice of “show both data that matches and data that does not” would be really helpful.</p>
<p dir="auto">Have I interpreted correctly: given the data in my text box, you would like to copy what I’ve shown selected in the image, but not the other sections.  Am I correct?</p>
<pre><code>BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:bla bla bla
...
END:VEVENT
BEGIN:VEVENT
...
SUMMARY:dont include me
...
END:VEVENT
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1601325697494-c7d8102d-2620-4ce2-8d3f-6c5278fb6a9a-image.png" alt="c7d8102d-2620-4ce2-8d3f-6c5278fb6a9a-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/58021</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58021</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:42:22 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:35:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a><br />
Thank You, in this files there is always something after SUMMARY:<br />
The <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a>  idea with RegEx seems fair, as I have 8 files to check, in each up to 50 BEGIN:VEVENT to END:VEVENT blocks. If it would be tuned to find in this block SUMMARY: bla bla bla this would be more than enought</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58019</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58019</guid><dc:creator><![CDATA[Marcin Jewiarz]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:35:00 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:26:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: Marcin-Jewiarz">@<bdi>Marcin-Jewiarz</bdi></a> said in <a href="/post/58015">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">SUMMARY: should have also defined string</p>
</blockquote>
<p dir="auto">As <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said we need a bit more info.<br />
There is the possibility that my solution has copied TOO much. That’s not a problem as then we could define an additional regex (regular expression) that worked on JUST the lines we extracted. that might be a bit simpler than attempting to be more exact with the first regex I supplied, especially if the criteria is not easily defined.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58018</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58018</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:26:33 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:23:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/58016">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">What does an empty/missing SUMMARY look like?</p>
</blockquote>
<p dir="auto">… or did I misinterpret, and you want a <em>specific</em> <code>bla bla bla</code>, not just empty/populated</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58017</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58017</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:22:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: Marcin-Jewiarz">@<bdi>Marcin-Jewiarz</bdi></a> said,</p>
<blockquote>
<p dir="auto">files that have defined string in SUMMARY: section</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a>’s solution shows how to do it for any contents of BEGIN:VEVENT to END:VEVENT, but I get the impression that you actually want a decision on whether a block should be marked based on whether SUMMARY was populated or not, in which case, it would be different.</p>
<p dir="auto">What does an empty/missing SUMMARY look like?  is it <code>SUMMARY:</code> with nothing (just a newline) after the colon, or is there just no <code>SUMMARY</code> line at all?</p>
<p dir="auto">Also, I grabbed a random .ics file that I had laying around, and it sometimes has things like <code>SUMMARY;ENCODING=QUOTED-PRINTABLE:blah blah blah</code> – should the syntax we come up with be able to handle extra parameters on the SUMMARY, or should it always assume <code>SUMMARY:</code>?</p>
<p dir="auto">I’ve never knowingly encountered a multi-event .ics file – but my iCalendar file experience is limited (until today, I had never opened one up and saw that it was text; I had always assumed it was a binary format).  But you also said,</p>
<blockquote>
<p dir="auto">I must extract important dates from many .ics.</p>
</blockquote>
<p dir="auto">So, to clarify: Can your .ics files have more than one event in them, or is each file a separate event?  And do you expect this macro (or in Terry’s suggestion, the single regex) to just copy from one input .ics at a time, or do you want the equivalent of a Find In Files which finds all matches in a list of files in one go?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58016</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58016</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:22:27 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:22:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a><br />
Thanks, but I need one more criterion, SUMMARY: should have also defined string, in this example “bla bla bla”.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58015</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58015</guid><dc:creator><![CDATA[Marcin Jewiarz]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:22:15 GMT</pubDate></item><item><title><![CDATA[Reply to .ics file selection problem on Mon, 28 Sep 2020 20:01:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marcin-jewiarz" aria-label="Profile: Marcin-Jewiarz">@<bdi>Marcin-Jewiarz</bdi></a> said in <a href="/post/58013">.ics file selection problem</a>:</p>
<blockquote>
<p dir="auto">would be from BEGIN:VEVENT to END:VEVENT</p>
</blockquote>
<p dir="auto">Yes it is possible. Given this file appears to be “text” based Notepad++ can open it. I suggest you will want to use the “Mark” function with bookmarking. this allows easy remove/copying after the mark has completed.</p>
<p dir="auto">So using the Mark function (under Search menu)<br />
Find What:<code>(?s-i)BEGIN:VEVENT.+?END:VEVENT</code><br />
Make sure “bookmark lines” is ticked and have search mode set to “regular expression”. Enter (copy red text above) into the find what window and press "Mark All’. You can now close the window and the main tab in Notepad++ should have lots of lines marked with a blue circle at the start of each line.</p>
<p dir="auto">At this point use the Copy (or Cut) bookmarked lines, which is under Search, then Bookmark.<br />
Open another tab and save them, then save the file.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58014</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58014</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 28 Sep 2020 20:01:32 GMT</pubDate></item></channel></rss>