<?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[Delete the entire content of all files with less than 100 words]]></title><description><![CDATA[<p dir="auto">0</p>
<p dir="auto">hello, Is it possible to delete the entire content of all files with less than 100 words? Can I use Regex?</p>
<p dir="auto">So. I try this regex, but needs to be improved a little bit. Can anyone help me?</p>
<p dir="auto">FIND: <code>(?s)(.*?(\w+\s?){1,100}).*$</code></p>
<p dir="auto">Replace with: <code>(EMPTY)</code></p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22815/delete-the-entire-content-of-all-files-with-less-than-100-words</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 19:20:53 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22815.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 06 Apr 2022 15:42:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Fri, 08 Apr 2022 08:33:56 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/75858">Delete the entire content of all files with less than 100 words</a>:</p>
<p dir="auto"><code>\A[^\w]*(?:\w+[^\w]+){0,4}(?:\w+[^\w]*)?\z</code></p>
<p dir="auto">My joy is that, thanks to my regex, an alternative method has been discovered, quite good.</p>
<p dir="auto">thank you <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75860</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75860</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Fri, 08 Apr 2022 08:33:56 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Fri, 08 Apr 2022 05:24:21 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I sorry to tell you that your <strong>last</strong> regex does <strong>not</strong> meet exactly the <strong>previous</strong> rules and is rather <strong>erroneous</strong> !</p>
<p dir="auto">First, and just anecdotal, the <strong><code>(?i)</code></strong> modifier is useless as <strong>no</strong> range of letters occurs in your regex</p>
<p dir="auto">Secondly, this regex will <strong>delete all</strong> file contents if <strong>more</strong> than <strong><code>0</code></strong> word char and <strong>less</strong> than <strong><code>7</code></strong> word chars</p>
<p dir="auto">Thirdly, let’s consider this somple phrase :</p>
<pre><code class="language-diff">let abc - xyz
</code></pre>
<p dir="auto">It contains <strong><code>4</code></strong> <strong>non-space</strong> expressions ( <strong><code>let</code></strong>, <strong><code>abc</code></strong>, <strong><code>-</code></strong> and <strong><code>xyz</code></strong> )</p>
<p dir="auto">Your regex seems OK as it <strong>correctly</strong> select all text which contains <strong>less</strong> than <strong><code>7</code></strong> words</p>
<p dir="auto">Now, change the <strong><code>-</code></strong> sign by a <strong><code>+</code></strong> sign :</p>
<pre><code class="language-diff">let abc + xyz
</code></pre>
<p dir="auto">This time, your regex does <strong>not</strong> match anything although there are, still, <strong><code>4</code></strong> <strong>non-space</strong> expressions :((</p>
<hr />
<p dir="auto">Why this behaviour occurs ? Well, the different <strong>sub</strong>-expressions, that you used in your regex, are <strong>erroneous</strong>  !</p>
<p dir="auto"><strong><code>[^\w+]*</code></strong> means <em>“find a a char different from a word char and different from the + sign”, repeated from <strong><code>0</code></strong> to any</em></p>
<p dir="auto"><strong><code>[\w*]+</code></strong> means <em>“find a word char or a * symbol”, repeated from <strong><code>1</code></strong> to any</em></p>
<p dir="auto"><strong><code>[^\w*]+</code></strong> means <em>“find a char different from a word char and different from the * symbol”, repeated from <strong><code>1</code></strong> to any</em></p>
<p dir="auto">So, an <strong>almost-correct</strong> solution would be  <strong><code>\A[^\w]*(?:\w+[^\w]+){0,4}(?:\w+[^\w]*)?\z</code></strong>. However, note that it also matches a <strong>true empty</strong> file which does <strong>not</strong> need any replacement as <strong>already</strong> empty !!</p>
<hr />
<p dir="auto">Now, the important drawback of using <strong>word</strong> chars <strong><code>\w</code></strong> and <strong>non-word</strong> chars <strong><code>[^\w]</code></strong>, is that <strong>any</strong> symbol, met in text, will <strong>increase</strong> the number of words !. For instance, see the difference betwen :</p>
<pre><code class="language-diff">This is a simple example
</code></pre>
<p dir="auto">and :</p>
<pre><code class="language-diff">This is a sim-ple example
</code></pre>
<p dir="auto">If I use my last <strong>“word”</strong> version <strong><code>\A[^\w]*(?:\w+[^\w]+){0,4}(?:\w+[^\w]*)?\z</code></strong>, it matches the text <strong><code>This is a simple example</code></strong> and <strong>not</strong> the text <strong><code>This is a sim-ple example</code></strong> ! Because, in the <strong>former</strong> case, it counts <strong><code>5</code></strong> words and, in the <strong>later</strong> case, it counts <strong><code>6</code></strong> words</p>
<p dir="auto">That’s why my <strong>previous</strong> and <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a>’s version, using <strong>non-space</strong> characters <strong><code>&lsqb;&lsqb;:^space:&rsqb;&rsqb;</code></strong> and <strong>space</strong> chars <strong><code>&lsqb;&lsqb;:space:&rsqb;&rsqb;</code></strong>, seems more <strong>rigorous</strong> and practical ;-))</p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75858</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75858</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 08 Apr 2022 05:24:21 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 14:33:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a></p>
<p dir="auto">Delete the entire content of all files with less than 6 words</p>
<p dir="auto">FIND:<br />
<code>\A(?i)[^\w+]*(?:[\w*]+[^\w*]+){0,5}(?:[\w*]+[^\w+]*)?\z</code></p>
<p dir="auto">REPLACE: <code>(LEAVE EMPTY)</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75847</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75847</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Thu, 07 Apr 2022 14:33:05 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 10:51:39 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> thank you very much !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75842</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75842</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Thu, 07 Apr 2022 10:51:39 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 10:26:20 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Oh… Yes ! I was <strong>wrong</strong> about it ! The <strong>correct</strong> regex S/R is, of course :</p>
<p dir="auto">SEARCH <strong><code>(?s)\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,8}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;.*\z|\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;+&lt;FINAL&gt;.*\z</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">And the <strong>general</strong> formula for <strong>deleting all</strong> file contents, if there are <strong>less</strong> than <strong><code>N</code></strong> words between the <strong>two</strong> boundaries <strong><code>&lt;START&gt;</code></strong> and <strong><code>&lt;FINAL&gt;</code></strong>, becomes :</p>
<p dir="auto">SEARCH <strong><code>(?s)\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,</code>N-2<code>}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;.*\z|\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;+&lt;FINAL&gt;.*\z</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<hr />
<p dir="auto">This regex will <strong>delete all</strong> file contents in <strong>all</strong> these cases :</p>
<ul>
<li>
<p dir="auto">If there <strong>no</strong> <strong><code>non-space</code></strong> char ( <strong><code>0</code></strong> word ), and only some <strong><code>space</code></strong> chars =&gt; the regex is <strong><code>\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;+&lt;FINAL&gt;.*\z</code></strong> ( the part <strong>after</strong> the <strong><code>|</code></strong> symbol )</p>
</li>
<li>
<p dir="auto">If there are <strong>several</strong> <strong><code>non-space</code></strong> chars ( <strong>one</strong> word ), <strong>possibly</strong> surrounded with <strong><code>space</code></strong> chars =&gt; quantifier = <strong><code>0</code></strong> and the regex becomes <strong><code>(?s)\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;.*\z</code></strong></p>
</li>
<li>
<p dir="auto">If there are <strong>several</strong> <strong><code>non-space</code></strong> chars followed with <strong><code>space</code></strong> chars, <strong>twice</strong> ( so <strong>two</strong> words) =&gt; quantifier = <strong><code>1</code></strong> and the regex becomes <strong><code>(?s)\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+)[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;.*\z</code></strong></p>
</li>
<li>
<p dir="auto">If there are <strong>several</strong> <strong><code>non-space</code></strong> chars followed with <strong><code>space</code></strong> chars, <strong>third</strong> times ( so <strong>three</strong> words) =&gt; quantifier = <strong><code>2</code></strong> and the regex becomes <strong><code>(?s)\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){2}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;.*\z</code></strong></p>
</li>
</ul>
<p dir="auto">and so on… till :</p>
<ul>
<li>If there are <strong>several</strong> <strong><code>non-space</code></strong> chars followed with <strong><code>space</code></strong> chars, <strong>ninth</strong> times ( so <strong>nine</strong> words) =&gt; quantifier = <strong><code>8</code></strong> and the regex becomes <strong><code>(?s)\A.*&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){8}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;.*\z</code></strong></li>
</ul>
<hr />
<p dir="auto">Now, to answer your question, I would say :</p>
<p dir="auto">SEARCH <strong><code>(?s)\A.*</code>BSR<code>(</code>FR<code>)</code>ESR<code>.*\z</code></strong></p>
<p dir="auto">where <strong>FR</strong> = <strong><code>&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,</code>N-2<code>}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*</code></strong>    <em>OR</em>    <strong>FR</strong> = <strong><code>&lsqb;&lsqb;:space:&rsqb;&rsqb;+</code></strong> ( case <strong>no</strong> word )</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75841</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75841</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 07 Apr 2022 10:26:20 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 09:21:11 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> by the way I test your generic formula you done for me.</p>
<p dir="auto"><code>(?s)&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,8}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;|&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;+&lt;FINAL&gt;</code></p>
<p dir="auto">In the context below, delete only everything that is framed in &lt;START&gt; and &lt;FINAL&gt;</p>
<p dir="auto">But does not delete the entire file, I mean the other words around it.</p>
<pre><code>blah blah     blah


&lt;START&gt;

The first, thing to note when

&lt;FINAL&gt;

   blah blah
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/75838</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75838</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Thu, 07 Apr 2022 09:21:11 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 09:10:49 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> correct me if I’m wrong. The GENERIC formula in this case will be:</p>
<p dir="auto"><code>(?s)BSR(FR)*ESR|BSR+ESR</code></p>
<p dir="auto">I think I’m wrong somewhere.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75837</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75837</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Thu, 07 Apr 2022 09:10:49 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 10:11:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi,  <a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><strong>EDIT</strong> : The regexes, below, are <strong>incomplete</strong>. See the <strong>correct</strong> solution in my <strong>next</strong> post</p>
<p dir="auto">You do <strong>not</strong> need to use these <strong>generic</strong> regexes at all !</p>
<p dir="auto">Simply, replace <strong><code>\A</code></strong> by <strong><code>&lt;START&gt;</code></strong> and <strong><code>\z</code></strong> by <strong><code>&lt;FINAL&gt;</code></strong> and, of course, change the value of the <strong>quantifier</strong> of the <strong>non-capturing</strong> group from <strong><code>98</code></strong> to <strong><code>8</code></strong>, giving the <strong>functional</strong> regex S/R below :</p>
<p dir="auto">SEARCH <strong><code>(?s)&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,8}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;|&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;+&lt;FINAL&gt;</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<hr />
<p dir="auto">So, the <strong>general</strong> formula for <strong>deleting all</strong> file contents, if there are <strong>less</strong> than <strong><code>N</code></strong> words between the <strong>two</strong> boundaries <strong><code>&lt;START&gt;</code></strong> and <strong><code>&lt;FINAL&gt;</code></strong>, is :</p>
<p dir="auto">SEARCH <strong><code>(?s)&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,</code>N-2<code>}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*&lt;FINAL&gt;|&lt;START&gt;&lsqb;&lsqb;:space:&rsqb;&rsqb;+&lt;FINAL&gt;</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75835</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75835</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 07 Apr 2022 10:11:17 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 08:15:31 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/75828">Delete the entire content of all files with less than 100 words</a>:<br />
<code>(?s)\A&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,98}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*\z|\A&lsqb;&lsqb;:space:&rsqb;&rsqb;+\z</code></p>
<p dir="auto">One more question I have for <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> I want to use one of your GENERIC S/R for this case. SO I need to delete the content of a file that have less then 10 words between section <strong>&lt;START&gt;</strong> and <strong>&lt;FINAL&gt;</strong></p>
<pre><code>&lt;START&gt;

The first, thing to note when

&lt;FINAL&gt;
</code></pre>
<p dir="auto">So, I test with all your GENERIC regex formulas you done a long time ago.</p>
<p dir="auto">BSR = <code>&lt;START&gt;</code><br />
ESR = <code>&lt;FINAL&gt;</code><br />
FR = <code>(?s)\A&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,10}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*\z|\A&lsqb;&lsqb;:space:&rsqb;&rsqb;+\z</code></p>
<p dir="auto">REGEX:</p>
<p dir="auto"><code>(?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\x20\K(FR)</code></p>
<p dir="auto"><code>(?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\x20\KFR(?=\x20)</code></p>
<p dir="auto"><code>(?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\x20\KFR</code></p>
<p dir="auto"><code>(?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\x20\KFR(?=\x20)</code></p>
<p dir="auto"><code>(?-i:BSR|\G(?!^))(?s:(?!ESR).)*?\K(?-i:FR)</code></p>
<p dir="auto"><code>(?-i:BSR|(?!\A)\G)(?s:(?!ESR).)*?\K(?-i:FR)</code></p>
<p dir="auto"><code>(?-i:BSR|(?!^)\G)(?s:(?!ESR).)*?\K(?-i:FR)</code></p>
<p dir="auto"><code>(?-i:BSR|(?!\A)\G)(?s:(?!ESR).)*?\K(?-i:FR)</code></p>
<p dir="auto">It is not working, in any of the cases.  I get the same message on F/R: “Cannot find the text…”</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75834</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75834</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Thu, 07 Apr 2022 08:15:31 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 06:57:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a><br />
<a href="https://npp-user-manual.org/docs/searching/#equivalence-classes" rel="nofollow ugc">Npp user manual</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75833</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75833</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Thu, 07 Apr 2022 06:57:35 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 05:57:15 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> <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/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: Neil-Schipper">@<bdi>Neil-Schipper</bdi></a></p>
<p dir="auto">thank you all. It is always a challenge to discover regex solutions.</p>
<p dir="auto">by the way, I didn’t know the method with <code>&lsqb;&lsqb;:punct:&rsqb;&rsqb;</code>  Where can I find about this regex method on internet? I don’t know how to search about it…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75830</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75830</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Thu, 07 Apr 2022 05:57:15 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Thu, 07 Apr 2022 01:31:32 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>, <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"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> :</p>
<p dir="auto">I found out a <strong>variant</strong> , based on your use of the <strong><code>&lsqb;&lsqb;:space:&rsqb;&rsqb;</code></strong> <strong>POSIX</strong> character class !</p>
<p dir="auto">SEARCH <strong><code>(?s)\A&lsqb;&lsqb;:space:&rsqb;&rsqb;*(?:[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){0,98}[^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;*\z|\A&lsqb;&lsqb;:space:&rsqb;&rsqb;+\z</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">This regex S/R will <strong>delete</strong> any content of files containing <strong>less</strong> than <strong><code>100</code></strong> words <em>OR</em> even <strong><code>0</code></strong> <strong>non-space</strong> char followed with some <strong><code>&lsqb;&lsqb;:space:&rsqb;&rsqb;</code></strong> chars</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75828</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75828</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 07 Apr 2022 01:31:32 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 21:42:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> said in <a href="/post/75823">Delete the entire content of all files with less than 100 words</a>:</p>
<blockquote>
<p dir="auto">None of our solutions tolerates non-word, non-space characters such as punctuation. A robust solution should probably make use of constructs like \W or &lsqb;&lsqb;:punct:&rsqb;&rsqb;.</p>
</blockquote>
<p dir="auto">I find this problem very intriguing. So I set my mind adrift in the regex documentation because; as <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: Neil-Schipper">@<bdi>Neil-Schipper</bdi></a> pointed out; this will likely involve use of character classes, which is where I had also considered it must go.</p>
<p dir="auto">It firstly involves what constitutes a word, most likely one or more “non-space” characters shown together. I fell upon a character class identifed as <code>&lsqb;&lsqb;:space:&rsqb;&rsqb;</code>, and it’s opposite <code>[^[:space:&rsqb;&rsqb;</code>.</p>
<p dir="auto">So using <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a>  regex I altered it to be:<br />
FW<code>(?s)\A(&lsqb;&lsqb;:space:&rsqb;&rsqb;*([^[:space:&rsqb;&rsqb;+&lsqb;&lsqb;:space:&rsqb;&rsqb;+){98,}.+)|.+</code><br />
RW:<code>\1</code></p>
<p dir="auto">I’m still not convinced I’m entirely there but I’ve put it up for public consumption. Maybe someone else wants to take it a bit further, refine it?</p>
<p dir="auto">So the premise is, find more than <code>x</code> number of words first, followed by the remainder of the file. As this is captured, return it. If this is not possible then use the alternation code and select all of the file and as it is not captured don’t return it. Hence we delete the file content if not equal or greater than the <code>x</code> number we seek.</p>
<p dir="auto">Terry</p>
<p dir="auto">Actually now I’ve posted I can see straight away I don’t need {98,}, it can just be {98} as the following <code>.+</code> takes care of the rest.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75827</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75827</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Wed, 06 Apr 2022 21:42:11 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 20:21:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a> said in <a href="/post/75825">Delete the entire content of all files with less than 100 words</a>:</p>
<blockquote>
<p dir="auto">can you please formulate a complete regex solution?</p>
</blockquote>
<p dir="auto">Yes, Neil please provide complete solution, taking into account every possible situation that we can’t know about, because we don’t know everything about OP’s data.  :-)</p>
<p dir="auto">Why are we even helping the notorious “Robin Cruise” anyway?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75826</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75826</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 06 Apr 2022 20:21:28 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 20:18:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> can you please formulate a complete regex solution?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75825</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75825</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Wed, 06 Apr 2022 20:18:50 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 20:16:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a> said :</p>
<blockquote>
<p dir="auto">This regex will delete the content of the files with less than 6 words<br />
FIND: <code>(?s)\A(.*?(\w+\s+){6}).*\Z</code><br />
REPLACE BY: LEAVE EMPTY</p>
</blockquote>
<p dir="auto">I don’t find that to be a true statement.</p>
<blockquote>
<p dir="auto">This regex will delete the content of the files with more than 6 words</p>
</blockquote>
<p dir="auto">OK…but the original spec was “less than” X words, not “more than”.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75824</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75824</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 06 Apr 2022 20:16:55 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 19:43:56 GMT]]></title><description><![CDATA[<p dir="auto">None of our solutions tolerates non-word, non-space characters such as punctuation. A robust solution should probably make use of constructs like <code>\W</code> or <code>&lsqb;&lsqb;:punct:&rsqb;&rsqb;</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75823</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75823</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Wed, 06 Apr 2022 19:43:56 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 19:36:44 GMT]]></title><description><![CDATA[<p dir="auto">thanks for the tip with \z (Seems to be a better with capital \Z )</p>
<p dir="auto">Anyway, I find another 2 solutions. But I will consider the case of 6 words instead of 100, to be easy to test.</p>
<p dir="auto">This regex will delete the content of the files with less than 6 words (you have to put 5 as for regex to count 6 )</p>
<p dir="auto">FIND: <code>(?s)\A(.*?(\w+\s+){6}).*\Z</code><br />
REPLACE BY: <code>LEAVE EMPTY</code></p>
<p dir="auto">This regex will delete the content of the files with more than 6 words (the same, you have to put 5 as for regex to count 6 )</p>
<p dir="auto">FIND: <code>(?s)(.*?(\w+\s+){5,}).*\Z</code><br />
REPLACE BY: <code>LEAVE EMPTY</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75822</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75822</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Wed, 06 Apr 2022 19:36:44 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 19:12:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a> said in <a href="/post/75819">Delete the entire content of all files with less than 100 words</a>:</p>
<blockquote>
<p dir="auto">it doesn’t seem to work. In addition, notepad ++ freezes for about 15 seconds</p>
</blockquote>
<p dir="auto">Yea, I tested my solution on a very small data set, where it worked OK, but I see with something larger the regex engine has to work too hard so it gives up.  Sorry, maybe Neil’s idea or someone else might have something to help you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75820</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75820</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 06 Apr 2022 19:12:25 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 18:40:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> said in <a href="/post/75814">Delete the entire content of all files with less than 100 words</a>:</p>
<blockquote>
<p dir="auto">\A(\s*\w+){0,99}\s*\z</p>
</blockquote>
<p dir="auto">thank you. I try your solution, it doesn’t seem to work. In addition, notepad ++ freezes for about 15 seconds</p>
<p dir="auto"><img src="/assets/uploads/files/1649270412738-ab664b19-2805-4327-a441-40d2f79689af-image.png" alt="ab664b19-2805-4327-a441-40d2f79689af-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75819</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75819</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Wed, 06 Apr 2022 18:40:16 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 17:13:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> That looks very nice.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75815</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75815</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Wed, 06 Apr 2022 17:13:16 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 17:08:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a></p>
<p dir="auto">Something close to this might do it: <code>\A(\s*\w+){0,99}\s*\z</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75814</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75814</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 06 Apr 2022 17:08:38 GMT</pubDate></item><item><title><![CDATA[Reply to Delete the entire content of all files with less than 100 words on Wed, 06 Apr 2022 17:08:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rodica-f" aria-label="Profile: rodica-f">@<bdi>rodica-f</bdi></a></p>
<p dir="auto">Here’s a game plan:</p>
<p dir="auto">Phase 1: prepend many-words files with a unique marker</p>
<ul>
<li>match &lt;file start&gt;&lt;anything, non-greedily&gt;&lt;sequence of &gt; 100 words, ie, use count specification <code>{101,}</code>&gt;&lt;anything, greedily&gt;</li>
<li>replace with something like <code>rodica does not want this file cleared out\r\n$0</code> or <code>ZX$0</code></li>
</ul>
<p dir="auto">Phase 2: clear all few-words files</p>
<ul>
<li>match &lt;negative look-behind: &lt;file start(<code>\A</code>)&gt;&lt;marker text&gt;&gt;&lt;anything, greedily&gt;</li>
<li>replace with nothing</li>
</ul>
<p dir="auto">Phase 3: remove markers from many-words files</p>
<ul>
<li>match &lt;file start(<code>\A</code>)&gt;&lt;marker text&gt;&lt;anything, greedily, captured to group 1&gt;</li>
<li>replace with group 1 text</li>
</ul>
<p dir="auto">Can you take it from here?</p>
<p dir="auto">Also, you don’t say if you want to do F&amp;R on all loaded files v. all specified files on disk. If the former, and you wish to preserve file dates, you don’t need to save modified, non-empty files after F&amp;R. If the latter, uncleared files will have undergone date modification.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75813</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75813</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Wed, 06 Apr 2022 17:08:13 GMT</pubDate></item></channel></rss>