<?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[remove a word in a block]]></title><description><![CDATA[<p dir="auto">hello<br />
i would to remove a word inside two tags<br />
by example “friends” in this example<br />
&lt;tag&gt;hello all my friends&lt;/tag&gt;<br />
&lt;tag&gt;your friends are kind&lt;/tag<br />
how? thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/13941/remove-a-word-in-a-block</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 02:16:04 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/13941.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Jun 2017 20:08:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to remove a word in a block on Mon, 12 Jun 2017 18:35:10 GMT]]></title><description><![CDATA[<p dir="auto">i think that i shall read the regex links before to try python :-)<br />
still thanks guy, your way to copy a block was really great for me</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24899</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24899</guid><dc:creator><![CDATA[Pouemes44]]></dc:creator><pubDate>Mon, 12 Jun 2017 18:35:10 GMT</pubDate></item><item><title><![CDATA[Reply to remove a word in a block on Mon, 12 Jun 2017 17:37:07 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/pouemes44" aria-label="Profile: pouemes44">@<bdi>pouemes44</bdi></a>,</p>
<p dir="auto">If, despite of all the regex <strong>links</strong>, given above, you 're still <strong>stuck</strong> about creating a <strong>correct</strong> regex, just post your problem. You’re <strong>welcome</strong> ;-))</p>
<p dir="auto">Of course, <strong>regular</strong> expressions are not as <strong>powerful</strong> as N++ <strong>Python</strong> or <strong>Lua</strong> scripts. But, you can’t imagine how <strong>tricky</strong> text changes can be done with them !!</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24896</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24896</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 12 Jun 2017 17:37:07 GMT</pubDate></item><item><title><![CDATA[Reply to remove a word in a block on Mon, 12 Jun 2017 03:15:31 GMT]]></title><description><![CDATA[<p dir="auto">a great thanks guy<br />
with all your explanations i succeed to do things i could not imagine before<br />
notepad++ with your explanations is really the tool i wanted<br />
i am not so young and i have never learn programation but with these syntax explanations i succed to do ~ what i want</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24886</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24886</guid><dc:creator><![CDATA[Pouemes44]]></dc:creator><pubDate>Mon, 12 Jun 2017 03:15:31 GMT</pubDate></item><item><title><![CDATA[Reply to remove a word in a block on Wed, 02 Jun 2021 22:02:49 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/pouemes44" aria-label="Profile: pouemes44">@<bdi>pouemes44</bdi></a>,</p>
<p dir="auto">First of all, <strong>pouemess44</strong>, just go back to my <strong>previous</strong> searched expression <strong><code>\x20friends?</code></strong>.</p>
<ul>
<li>
<p dir="auto">The <strong><code>\x20</code></strong> syntax represents a simple <strong>space</strong> character, of Unicode code-point <strong><code>\x{0020}</code></strong>. You could have used, instead, a <strong>classical space</strong> character !</p>
</li>
<li>
<p dir="auto">At the end, the quantifier <strong><code>?</code></strong> is, simply, a shortcut of the normal syntax <strong><code>{0,1}</code></strong>, meaning that the character, located <strong>before</strong> the <strong><code>?</code></strong> must be present <strong>0</strong> till <strong>1</strong> times. In other words, the <strong>plural</strong> form <strong><code>s</code></strong> must be <strong>present</strong> or <strong>not</strong>, after the word <strong>friend</strong></p>
</li>
</ul>
<p dir="auto">Therefore, if you’re looking for the exact word “<strong>poem</strong>”, you must <strong>not</strong> add the <strong>question mark</strong> special character, at the end !<br />
Indeed, the regex <strong><code>poem?</code></strong> means that you want, either, the <strong>exact</strong> word “<strong>poem</strong>” OR “<strong>poe</strong>” ( letter <strong>m</strong> present or <strong>not</strong> ! )</p>
<hr />
<p dir="auto">Now, to avoid that you get <strong>matches</strong> of your searched expression, when it’s <strong>embedded</strong> in a larger word, change the part <strong><code>\x20friends?</code></strong> into the regex <strong><code>\bfriends?\b</code></strong>. The <strong><code>\b</code></strong> syntax is an <strong>assertion</strong> ( a <strong>condition</strong> which must be respected ), which represents the <strong>zero</strong>-length location, between, <strong>either</strong> :</p>
<ul>
<li>
<p dir="auto">A <strong>Word</strong> character AND a <strong>Non-Word</strong> character</p>
</li>
<li>
<p dir="auto">A <strong>Non-Word</strong> character AND a <strong>Word</strong> character</p>
</li>
</ul>
<p dir="auto">Remember that the <strong>default Word</strong> characters range is  any <strong>uppercase</strong> / <strong>lowercase</strong> letter, <strong>accentuated</strong> or not, any <strong>digit</strong> form OR the <strong>low line</strong> character, of code point <strong><code>\x{005f}</code></strong></p>
<p dir="auto">So, the <strong>final</strong> regex should rather be : <strong><code>(?s)\bfriends?\b(?=((?!&lt;tag&gt;).)*&lt;/tag&gt;)</code></strong></p>
<p dir="auto">If you’re searching for some words, as the sentence “<strong>I love this poem</strong>”,  just use the regex <strong><code>(?s)\bI love this poem\b(?=((?!&lt;tag&gt;).)*&lt;/tag&gt;)</code></strong></p>
<p dir="auto">And, if, in addition, you want an search, <strong>whatever</strong> the case of the letters, add the <strong><code>(?i)</code></strong> modifier, at the <strong>beginning</strong> of the regex, meaning that the regex search will be performed in a <strong>insensitive</strong> way</p>
<p dir="auto">So, to sum up, if you’re looking for, either, the <strong>exact</strong> sentence “<strong>I love this poem</strong>” OR the sentence “<strong>I love these poems</strong>”, whatever their case, between a <strong>starting</strong> tag <strong><code>&lt;tag&gt;</code></strong> and an <strong>ending</strong> tag <strong><code>&lt;/tag&gt;</code></strong> <strong>only</strong>, whatever their location, use the regex, below :</p>
<p dir="auto">SEARCH <strong><code>(?si)\bI love th(is poem|ese poems)\b(?=((?!&lt;tag&gt;).)*&lt;/tag&gt;)</code></strong></p>
<hr />
<p dir="auto">For a <strong>deeper</strong> investigation, and if your <strong>html</strong> file does <strong>not</strong> contain <strong>confidential</strong> information, you could <strong>send</strong> me your file ( or part of it), if you don’t mind, by mail, at my address :</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong>:</p>
<p dir="auto">For <strong>newby</strong> people, about <strong>regular</strong> expressions <strong>concept</strong> and <strong>syntax</strong>, begin with that article, in <strong>N++ Wiki</strong> :</p>
<p dir="auto"><a href="http://docs.notepad-plus-plus.org/index.php/Regular_Expressions" rel="nofollow ugc">http://docs.notepad-plus-plus.org/index.php/Regular_Expressions</a></p>
<p dir="auto">In addition, you’ll find <strong>good documentation</strong>, about the new <strong>Boost C++ Regex library, v1.55.0</strong> ( similar to the <strong>PERL Regular Common Expressions, v1.48.0</strong> ), used by <strong><code>Notepad++</code></strong>, <em>since its <strong><code>6.0</code></strong> version</em>, at the <strong>TWO</strong> addresses below :</p>
<p dir="auto"><a href="http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html" rel="nofollow ugc">http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html</a></p>
<p dir="auto"><a href="http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html" rel="nofollow ugc">http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html</a></p>
<ul>
<li>
<p dir="auto">The <strong>FIRST</strong> link explains the <strong>syntax</strong>, of regular expressions, in the <strong>SEARCH</strong> part</p>
</li>
<li>
<p dir="auto">The <strong>SECOND</strong> link explains the <strong>syntax</strong>, of regular expressions, in the <strong>REPLACEMENT</strong> part</p>
</li>
</ul>
<hr />
<p dir="auto">You may, also, look for <strong>valuable</strong> informations, on the <strong>sites</strong>, below :</p>
<p dir="auto"><a href="http://www.regular-expressions.info" rel="nofollow ugc">http://www.regular-expressions.info</a></p>
<p dir="auto"><a href="http://www.rexegg.com" rel="nofollow ugc">http://www.rexegg.com</a></p>
<p dir="auto"><a href="http://perldoc.perl.org/perlre.html" rel="nofollow ugc">http://perldoc.perl.org/perlre.html</a></p>
<p dir="auto">Be aware that, as any <strong>documentation</strong>, it may contain some <strong>errors</strong> ! Anyway, if you detected one, that’s <strong>good news</strong> : you’re improving ;-))</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24880</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24880</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 02 Jun 2021 22:02:49 GMT</pubDate></item><item><title><![CDATA[Reply to remove a word in a block on Sat, 10 Jun 2017 07:05:10 GMT]]></title><description><![CDATA[<p dir="auto">and sometimes take the &lt;!doctype html&gt;  with two word but not always, i cannot undesrtand why</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24879</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24879</guid><dc:creator><![CDATA[Pouemes44]]></dc:creator><pubDate>Sat, 10 Jun 2017 07:05:10 GMT</pubDate></item><item><title><![CDATA[Reply to remove a word in a block on Sat, 10 Jun 2017 06:47:09 GMT]]></title><description><![CDATA[<p dir="auto">other problem<br />
with the word poem it took also poe of the word poetry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24878</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24878</guid><dc:creator><![CDATA[Pouemes44]]></dc:creator><pubDate>Sat, 10 Jun 2017 06:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to remove a word in a block on Sat, 10 Jun 2017 05:49:39 GMT]]></title><description><![CDATA[<p dir="auto">hello guy<br />
a great thanks</p>
<p dir="auto">1:<br />
if i associe two words<br />
(?s)\x20love poem?(?=((?!&lt;tag&gt;).)*&lt;/tag&gt;)<br />
it works but with the word i would poem it took also the &lt;!doctype html&gt; of my page so delete all</p>
<p dir="auto">2:<br />
is there a way to delete only poem, not poems or reverse?</p>
<p dir="auto">3<br />
i shall be happy to show you my project, but i dont dare to post a link here and i dont see how to post private messages</p>
<p dir="auto">still thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24877</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24877</guid><dc:creator><![CDATA[Pouemes44]]></dc:creator><pubDate>Sat, 10 Jun 2017 05:49:39 GMT</pubDate></item><item><title><![CDATA[Reply to remove a word in a block on Sat, 10 Jun 2017 11:44:45 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/pouemes44" aria-label="Profile: pouemes44">@<bdi>pouemes44</bdi></a>,</p>
<p dir="auto">Not very easy to find a <strong>correct</strong> regex ;-)) In addition, I preferred to consider the general case with <strong>several</strong> words <strong>friends</strong>, inside a <strong>single</strong> block <strong>&lt;tag&gt;<code>.........</code>&lt;/tag&gt;</strong></p>
<p dir="auto">So, starting with this example, below, in an <strong>unique</strong> line :</p>
<pre><code class="language-diff">Jim said : "Here come my friends" &lt;tag&gt;Hello, all my friends ! You are all kind, my friends&lt;/tag&gt;  All the friends smiled and its friends answered :&lt;tag&gt;"No, we're just happy to be your friend !". Then, its friends gave a toast to him&lt;/tag&gt; After a while, Jim said : "Sorry, my friends, I must go, by now !
</code></pre>
<p dir="auto">If the <strong>search</strong> regex is <strong><code>(?s)\x20friends?(?=((?!&lt;tag&gt;).)*&lt;/tag&gt;)</code></strong>, it would find a <strong>space</strong> character, <strong>followed</strong> by, either, the word <strong>friend</strong> OR <strong>friends</strong>, ONLY IF they are <strong>embedded</strong> in a <strong>&lt;tag&gt;…&lt;/tag&gt;</strong></p>
<p dir="auto">And, with a <strong>empty</strong> replacement zone, it would <strong>delete</strong> any word <strong>friend</strong> and <strong>friends</strong> with its <strong>leading Space</strong> character</p>
<p dir="auto">So, we get the <strong>modified</strong> text below :</p>
<pre><code class="language-diff">Jim said : "Here come my friends" &lt;tag&gt;Hello, all my ! You are all kind, my&lt;/tag&gt;  All the friends smiled and its friends answered :&lt;tag&gt;"No, we're just happy to be your !". Then, its gave a toast to him&lt;/tag&gt; After a while, Jim said : "Sorry, my friends, I must go, by now !
</code></pre>
<hr />
<p dir="auto">Moreover, even if the <strong>example</strong> text is <strong>split</strong> on <strong>several</strong> lines, as below, this regex <strong>does</strong> the job, too !</p>
<pre><code class="language-diff">Jim said : "Here come my friends"
&lt;tag&gt;Hello, all my friends ! You are all kind, my friends&lt;/tag&gt;
All the friends smiled and its friends answered :
&lt;tag&gt;"No, we're just happy to be your friend !". Then, its friends gave a toast to him&lt;/tag&gt;
After a while, Jim said : "Sorry, my friends, I must go, by now !
</code></pre>
<p dir="auto">And, also, if the the blocks <strong>&lt;tag&gt;<code>.........</code>&lt;/tag&gt;</strong> are split, themselves, in <strong>several</strong> lines, as below !</p>
<pre><code class="language-diff">Jim said : "Here come my friends"
&lt;tag&gt;Hello, all my friends !
You are all kind, my friends&lt;/tag&gt;
All the friends smiled and its friends answered :&lt;tag&gt;"No, we're just happy to be your friend !".
Then, its friends gave a toast to him&lt;/tag&gt;
After a while, Jim said : "Sorry, my friends, I must go, by now !
</code></pre>
<hr />
<p dir="auto">Notes :</p>
<ul>
<li>
<p dir="auto">As usual, the <strong><code>(?s)</code></strong> modifier means that the <strong>dot</strong> meta-character will match any <strong>single</strong> character ( <strong>standard</strong> and <strong>EOL</strong> ones )</p>
</li>
<li>
<p dir="auto">Then the part <strong><code>\x20friends?</code></strong> simply looks for a <strong>space</strong> character, <strong>followed</strong> by the word <strong>friend</strong> or <strong>friends</strong></p>
</li>
<li>
<p dir="auto">To easily understand the <strong>final</strong> part <strong><code>(?=((?!&lt;tag&gt;).)*&lt;/tag&gt;)</code></strong>, it’s better to speak, <strong>first</strong>, about the <strong>more simple</strong> regex <strong><code>(?=.*&lt;/tag&gt;)</code></strong> which is a <strong>look-ahead</strong>. In other words, a <strong>condition</strong> which <strong>must</strong> be verified to get an <strong>overall</strong> match. This condition says that the word <strong>friends?</strong> must be <strong>followed</strong>, further on, by the most far string <strong>&lt;/tag&gt;</strong></p>
</li>
<li>
<p dir="auto">Now, it’s not difficult to notice that, between the word <strong>friend[s]</strong> and the last <strong>&lt;/tag&gt;</strong> of the text, there are, probably, several <strong>juxtaposed</strong> blocks <strong>&lt;tag&gt;<code>........</code>&lt;/tag&gt;</strong>. So an <strong>additional</strong> condition must be added : At any location, after an opening tag <strong>&lt;tag&gt;</strong>, till the nearest <strong>&lt;/tag&gt;</strong>, an other opening tag <strong>&lt;tag&gt;</strong> should <strong>NOT</strong> be found !</p>
</li>
<li>
<p dir="auto">Therefore, we changed the small part <strong><code>.*</code></strong> of the <strong>previous</strong> regex, standing for a <strong>range</strong> of characters, by the more <strong>restrictive</strong> regex <strong><code>((?!&lt;tag&gt;).)*</code></strong>. And combining with the <strong>previous</strong> regex, we get our <strong>final</strong> regex <strong><code>(?s)\x20friends?(?=((?!&lt;tag&gt;).)*&lt;/tag&gt;)</code></strong> !</p>
</li>
</ul>
<hr />
<p dir="auto"><strong>Important</strong> : My regex does <strong>NOT</strong> work in case of <strong>nested</strong> blocks, as <strong>&lt;tag&gt;<code>.........</code>&lt;tag&gt;<code>........</code>&lt;/tag&gt;<code>.........</code>&lt;/tag&gt;</strong></p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/24873</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/24873</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 10 Jun 2017 11:44:45 GMT</pubDate></item></channel></rss>