<?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[Help with Regex to delete a block in paragraph/line]]></title><description><![CDATA[<p dir="auto">Hi all,<br />
Let say I have the paragraph below. Is it possible to use notepade++ to delete just the &lt;block…&gt;. the &lt;block&gt; could vary in length ,but it is shorter than 20 character</p>
<p dir="auto">Answer &lt;block01&gt;misery adieus add wooded how nay men before though. &lt;block0002  &gt; Pretended  belonging contented mrs suffering favourite you the continual. Mrs civil nay least means tried drift. Natural &lt;block0000005&gt;end law whether but and towards certain. Furnished unfeeling his sometimes see day promotion. Quitting informed concerns can men now.</p>
<p dir="auto">Thank you</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/14898/help-with-regex-to-delete-a-block-in-paragraph-line</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 11:52:58 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/14898.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 Dec 2017 21:37:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help with Regex to delete a block in paragraph/line on Sun, 10 Dec 2017 14:56:55 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><br />
Thank you for the thorough explanation</p>
<p dir="auto">(?-si)&lt;block.*?&gt; works better than expected for me, even when inside the &lt;block…&gt; exceed 20  characters.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28572</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28572</guid><dc:creator><![CDATA[du p]]></dc:creator><pubDate>Sun, 10 Dec 2017 14:56:55 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Regex to delete a block in paragraph/line on Sun, 10 Dec 2017 15:28:56 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/du-p" aria-label="Profile: du-p">@<bdi>du-p</bdi></a>, and <strong>All</strong>,</p>
<p dir="auto">Ah, <strong>du-p</strong>! I understood your problem !</p>
<p dir="auto">Let’s start with the text, below, where I <strong>added</strong> three ranges <strong><code>&lt;block....&gt;</code></strong>, to you <strong>initial</strong> text :</p>
<pre><code class="language-xml">Answer &lt;block01&gt;misery adieus add wooded how nay men before though. &lt;block0002 &gt; Pretended belonging contented mrs suffering&lt;block&gt; favourite you the continual. Mrs civil nay least means tried drift. Natural &lt;block0000005&gt;end law whether but and towards certain. Furnished unfeeling his sometimes see day promotion. Quitting informed &lt;block12345678901234567890&gt;concerns can men &lt;block123456789012345678901&gt;now.
</code></pre>
<p dir="auto">You’ve certainly gave a <strong>try</strong> to the regex <strong><code>&lt;block.*&gt;</code></strong> and you were <strong>surprised</strong> to notice that it matches from <strong><code>&lt;block01&gt;</code></strong> to the <strong>last</strong> block <strong><code>&lt;block123456789012345678901&gt;</code></strong>, included ! weren’t you ?</p>
<p dir="auto">Simply, because the <strong>dot</strong> ( <strong><code>.</code></strong>), followed by the <strong>quantifier</strong> <strong><code>*</code></strong> ( or its equivalent <strong><code>{0,}</code></strong> ) represents the <strong>greatest</strong> range of <strong>any standard</strong> character, till a <strong><code>&gt;</code></strong> symbol. That’s the default <strong>“greedy”</strong> behaviour.</p>
<p dir="auto">And I guess that you wanted to <strong>limit</strong> the search to the <strong>next 20</strong> characters, after <strong><code>&lt;block</code></strong>, to get <strong>individual</strong> blocks, only !</p>
<p dir="auto">This is <strong>useless</strong>, as you may use the <strong>“lazy”</strong> behaviour, by adding an <strong>interrogation</strong> mark, <strong>after</strong> the <strong><code>*</code></strong> quantifier !</p>
<p dir="auto">So, the <strong>final</strong> regex S/R would be :</p>
<p dir="auto">SEARCH <strong><code>(?-si)&lt;block.*?&gt;</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">OPTIONS <strong><code>Regular expression</code></strong></p>
<p dir="auto">ACTION : <strong><code>Replace</code></strong> or <strong><code>Replace All</code></strong></p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>first</strong> part  <strong><code>(?-si)</code></strong> ( equivalent to <strong><code>(?-s)(?-i)</code></strong> ) means that :</p>
<ul>
<li>
<p dir="auto">The <strong>dot</strong> special character matches any <strong>single standard</strong> character, only, and NOT <strong>End of Line</strong> chars</p>
</li>
<li>
<p dir="auto">The search is performed, in a <strong>sensitive</strong> way. So, it would <strong>not</strong> match, for instance, the string <strong><code>&lt;BlocK...&gt;</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto">Then it matches the <strong>exact</strong> string <strong><code>&lt;block</code></strong>, followed by the <strong>smallest</strong> range of <strong>standard</strong> characters, till an <strong>ending</strong> symbol <strong><code>&gt;</code></strong></p>
</li>
<li>
<p dir="auto">As the replacement zone is <strong>empty</strong>, theses ranges <strong><code>&lt;block....&gt;</code></strong> are simply <strong>deleted</strong></p>
</li>
</ul>
<hr />
<p dir="auto">Note that you may, as well, use the <strong>20</strong> characters <strong>limit</strong>, if you prefer to ! This time, the regex becomes :</p>
<p dir="auto"><strong><code>(?-si)&lt;block.{0,20}?&gt;</code></strong></p>
<p dir="auto">Applied against the text below :</p>
<pre><code class="language-xml">Answer &lt;block01&gt;misery adieus add wooded how nay men before though. &lt;block0002 &gt; Pretended belonging contented mrs suffering&lt;block&gt; favourite you the continual. Mrs civil nay least means tried drift. Natural &lt;block0000005&gt;end law whether but and towards certain. Furnished unfeeling his sometimes see day promotion. Quitting informed &lt;block12345678901234567890&gt;concerns can men &lt;block123456789012345678901&gt;now.
</code></pre>
<p dir="auto">It would miss the last <strong><code>&lt;block...&gt;</code></strong>, because <strong>21 digits</strong> are located, between <strong><code>&lt;block</code></strong> and <strong><code>&gt;</code></strong> !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28570</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28570</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 10 Dec 2017 15:28:56 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Regex to delete a block in paragraph/line on Sat, 09 Dec 2017 22:10:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/du-p" aria-label="Profile: du-p">@<bdi>du-p</bdi></a></p>
<p dir="auto">Sorry, if you can’t describe your data well with the first go-round, I lose interest; maybe somebody else can pick it up and help…?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28563</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28563</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sat, 09 Dec 2017 22:10:44 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Regex to delete a block in paragraph/line on Sat, 09 Dec 2017 22:05:45 GMT]]></title><description><![CDATA[<p dir="auto">Forgot to mention that there can be any character besides the number after the word “block”. Ex: &lt;block a&gt; , &lt;block bac&gt; . I’m wondering what you can delete the block base on the start character “&lt;” and the end character “&gt;”. If I use the wild "* " like  &lt;(.<em>)&gt;, it would select all the character until the end of the paragraph. I’m wondering if there is such a thing so that you can define a range for the wild card. For example something arbitrary like &lt;(20</em>)&gt; would look for 20 characters within the &lt;&gt;.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28562</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28562</guid><dc:creator><![CDATA[du p]]></dc:creator><pubDate>Sat, 09 Dec 2017 22:05:45 GMT</pubDate></item><item><title><![CDATA[Reply to Help with Regex to delete a block in paragraph/line on Sat, 09 Dec 2017 21:50:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/du-p" aria-label="Profile: du-p">@<bdi>du-p</bdi></a></p>
<p dir="auto">I would try a Replace operation as follows:</p>
<p dir="auto"><strong>Find-what</strong> zone: <code>&lt;block\d+&gt;</code><br />
<strong>Replace-with</strong> zone: make sure this is empty<br />
<strong>Search mode</strong>:  <code>Regular expression</code></p>
<p dir="auto"><code>\d+</code> stands for one or more digit characters, 0-9.  From your description It is hard to tell what you might need to delete as far as whitespace goes, on either side of the bracketed text…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28561</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28561</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sat, 09 Dec 2017 21:50:46 GMT</pubDate></item></channel></rss>