<?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[How to remove duplicate words in a line using Notepad++?]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I need a regex that will find duplicate words between the tabulation character (\t)  and the end of the line (\r\n), keep one occurrence  of them and remove the rest of the duplicates.</p>
<p dir="auto">The regex should <strong>not</strong> treat the following as a duplicate:</p>
<p dir="auto"><em><strong>offspring</strong> \t <strong>offspring</strong> \r\n</em></p>
<p dir="auto">With duplicate words, I mean:</p>
<ul>
<li>
<p dir="auto"><em>both consecutive and non-consecutive duplicate words (with variable distances -up to, say, 30 words- between the duplicates)</em>: “<strong>offspring</strong>, <strong>offspring</strong>”, “<strong>offspring</strong>, spring, off, <strong>offspring</strong>”</p>
</li>
<li>
<p dir="auto"><em>verbatim copy of text units:</em> “<strong>off-spring, off-spring</strong>, offspring, offspring, <strong>off spring, off spring</strong>, offsprings, offsprings, <strong>offspring’s, offspring’s</strong>, spring, spring, <strong>off, off</strong>, of, of, <strong>ring, ring</strong>”</p>
</li>
</ul>
<p dir="auto">So, after removing the duplicates from the following line</p>
<p dir="auto">word \t off-spring, <em>off-spring</em>, offspring, <em>offspring</em>, off spring, <em>off spring</em>, offsprings, <em>offsprings</em>, offspring’s, <em>offspring’s</em>, spring, <em>spring</em>, off, <em>off</em>, of, <em>of</em>, ring, ring \r\n</p>
<p dir="auto">it should give the following result:</p>
<p dir="auto">word \t off-spring, offspring, off spring, offsprings, offspring’s, spring, off, of, ring\r\n</p>
<p dir="auto">Thanks in advance!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/12835/how-to-remove-duplicate-words-in-a-line-using-notepad</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Nov 2026 11:32:27 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/12835.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Dec 2016 06:33:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Fri, 30 Dec 2016 12:17:13 GMT]]></title><description><![CDATA[<p dir="auto">One more thing:</p>
<p dir="auto">When this regex finds no duplicates to delete, does it delete all lines, hence is this same as with the third consecutive click? As already said, the fact that it deletes all the lines with the third click is fine, but it would be very nice and helpful if it would give the usual (and expected) info, just like others, like <em>“0 occurrence was replaced”</em>, instead of deleting all the lines when it founds no duplicate to delete.</p>
<p dir="auto">And one strange thing:</p>
<p dir="auto">Sometimes, after the first and second click on “replace all”, it states <em>“<strong>1</strong> occurrence was replaced”</em> , but the colour of the “save icon” on the tab of the file doesn’t change to red, indicating that the files is modified.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/20390</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/20390</guid><dc:creator><![CDATA[glossar]]></dc:creator><pubDate>Fri, 30 Dec 2016 12:17:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Fri, 30 Dec 2016 11:18:41 GMT]]></title><description><![CDATA[<p dir="auto">Hello guy,</p>
<p dir="auto">I’m back to this topic again as I want to bring to your attention some problem I have encountered. Maybe you could help me with fixing it.</p>
<p dir="auto">I was going to ask this long ago. You have written in your above explanation:</p>
<p dir="auto"><em>“Some matches may be found, by error, or, the opposite, not found, at all, by the regex engine, when using look-behinds”</em></p>
<p dir="auto">Just to be sure, does this apply to the regex you have built or to the regex engine in Notepad?</p>
<p dir="auto">How technically reliable is this regex? I can imagine what precisely works for a prototype or a small set, may not work for bulk amounts, at least not at the same precision level. And I guess regexes are no exception to this. Since great power (of a regex) comes with great responsibility/danger (of losing data) and I cannot one by one go through the changes this regex makes, I want to have an overall idea about much risk in terms losing data I take using this regex.</p>
<p dir="auto">I have noticed that by the third click, this regex deletes all the lines (which is fine and hence your highlighting “run <strong>TWICE</strong>”). But how does this regex sense/know whether a click is a first or second or third click? Or to put differently: How and when is a file state reset for this regex? Closing and re-opening a file? Making a change (e.g. adding or deleting lines) in the file or editing some line and saving and reopening it? Several days ago when I first applied this regex, along with the other one ((?-s)^((.+\t).+)\R\2(.+)) and sorting/deleting duplicate lines, to one of my two glossaries in order to keep them clean and neat, I couldn’t somehow manage to apply all these operations and I don’t know in which state or at which step I have left the file. Today I added some entries to it and wanted to apply all these again: sorting/deleting duplicate lines via FX plugin, merging lines with “(?-s)^((.+\t).+)\R\2(.+)” and finally removing the duplicate words with this regex. But with the first click, this regex reduces the number of lines tremendously. Please have a look at the screenshots:</p>
<p dir="auto">This is before the first click:<br />
<a href="https://snag.gy/okswaC.jpg" rel="nofollow ugc">https://snag.gy/okswaC.jpg</a></p>
<p dir="auto">This is after the first click:<br />
<a href="https://snag.gy/6yzpBW.jpg" rel="nofollow ugc">https://snag.gy/6yzpBW.jpg</a></p>
<p dir="auto">This is after the second click. It deletes all the lines, which makes me suspect the file is already in the first click state, since with the third click it deletes all the lines.<br />
<a href="https://snag.gy/3jtkNc.jpg" rel="nofollow ugc">https://snag.gy/3jtkNc.jpg</a></p>
<p dir="auto">This is another try, after copying and pasting the whole text into a new file. After first click:<br />
<a href="https://snag.gy/P0GX2z.jpg" rel="nofollow ugc">https://snag.gy/P0GX2z.jpg</a></p>
<p dir="auto">Thank you in advance for your help!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/20389</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/20389</guid><dc:creator><![CDATA[glossar]]></dc:creator><pubDate>Fri, 30 Dec 2016 11:18:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Sun, 11 Dec 2016 11:46:35 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 very much for the reply! You are such an expert on Regex!! And N++!</p>
<p dir="auto">Your post definitely deserves documented somewhere more official, to help more people! I mean, is it possible to improve the current wiki page(either the N++ official one, or the wikipedia)?<br />
I saw quite a few obvious errors on the N++ official wiki page, but couldn’t find an entrance to register in order to edit the regex tutorial.</p>
<p dir="auto">For example, I think it’s quite benificial for a user to know the limits of Regex.<br />
As for me, after reading your post in this thread, I’ll avoid using <code>\K</code> myself if possible.</p>
<p dir="auto">You could actually make an excellent tutorial I believe!</p>
<p dir="auto">Best regards.<br />
Great thanks again!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19857</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19857</guid><dc:creator><![CDATA[古旮]]></dc:creator><pubDate>Sun, 11 Dec 2016 11:46:35 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Tue, 06 Dec 2016 21:21:47 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <strong>古旮</strong>,</p>
<p dir="auto">To begin with, as this post is <strong>quite long</strong>, just have a <strong>drink</strong> ! , …and  let’s go :</p>
<p dir="auto">Ah yes, I just realized that, if we use my <strong>long example</strong> line :</p>
<pre><code>12345 word 99099    spring, off-spring, of,....................................., spring, of, ring, off-spring, off, 99099 
</code></pre>
<p dir="auto">Then, after hitting <strong>many</strong> times on the <strong>Replace</strong> button, I <strong>almost</strong> got the <strong>expected</strong> result : only the word <strong>spring</strong>, right after the <strong>tabulation</strong> character, should have been <strong>deleted</strong>. So, after moving the <strong>caret</strong>, some lines before, and performing this S/R again, it was OK !</p>
<p dir="auto">By the way, as before the <strong><code>\K</code></strong> syntax, there’s, only one <strong>tabulation</strong> character ( case of <strong>fixed length</strong> string ! ), my <strong>previous</strong> regex may, also, be written :</p>
<p dir="auto">SEARCH <strong><code>(?-s)((?&lt;=\t)|, )(.+?)(?=, (?:.+, )?\2(, |\R))|(?&lt;=\t),[ ]</code></strong></p>
<p dir="auto">REPLACE <strong>Let <code>EMPTY</code></strong></p>
<hr />
<p dir="auto">Like you, I think that it’s a bit <strong>weird</strong> that it can select the <strong>right</strong> match but <strong>cannot delete</strong> that selection !?? Unfortunately, sometimes when hitting the <strong>Replace button</strong>, it’s even worse as it may forget some matches or select wrong matches !<br />
It’s quite difficult to tell you, in what <strong>exact</strong> cases, this behaviour occurs. But I noticed it when the <strong>last</strong> character, of the <strong>look-behind</strong> and the <strong>first</strong> character, of the <strong>main</strong> regex, refer to the <strong>same</strong> set of characters !</p>
<hr />
<p dir="auto">So, to my mind, we <strong>do</strong> need to <strong>improve</strong> the <strong>present</strong> regular S/R regex engine, by using the <strong>François-R Boyer</strong> version. Of course, when the <strong>Boost regex</strong> library, similar to PCRE (Perl Compatible Regular Expressions ), was implemented in N++, on March 2012, some <strong>improvements</strong>, between the N++ version <strong>6.0</strong> and version <strong>6.4.2</strong>, were done and some <strong>bugs</strong> were fixed by, both, <strong>Dave BrotherStone</strong> and <strong>François-R Boyer</strong> ( as the <strong>Zero length match</strong> call-tip message,… )</p>
<p dir="auto">However, <em>although the <strong>non</strong>-official <strong>François</strong>’s version, simply, relies on the <strong>BOOST</strong> library</em>, he was able to fix major <strong>issues</strong>, relative to <strong>look-behinds</strong> and <strong>backward assertions</strong>, and succeeded to manage <strong>all UNICODE</strong> characters, as well as <strong>NUL</strong> characters, in <strong>replacement</strong> !</p>
<p dir="auto">Here are, below, a <strong>non</strong> exhaustive list of issues with the <strong>current</strong> regex engine,_ which do <strong>not</strong> occur, with <strong>François-R Boyer</strong>’s version_ :</p>
<hr />
<ul>
<li>
<p dir="auto"><strong>Overlapping</strong> lookbehinds and matched strings are NOT correctly handled. For instance, giving the <strong>20 characters subject</strong> string <strong>aaaabaaababbbaabbabb</strong> and SEARCH = <strong><code>(?&lt;!a)ba*</code></strong>, we get <strong>6</strong> matches, but, unfortunately, <strong>2</strong> results are wrong. On the opposite, if SEARCH = <strong><code>(?&lt;=a)ba*</code></strong>, we obtain <strong>4</strong> matches, but, it <strong>misses</strong> the string <strong>ba</strong>, at positions <strong>10</strong> and <strong>11</strong> :-(( With the <strong>improved</strong> version of <strong>François-R Boyer</strong>, it’s all OK !</p>
</li>
<li>
<p dir="auto">We can’t use the <strong>NUL</strong> character in replacement. For example, the simple S/R : SEARCH = <strong><code>ABC</code></strong> and REPLACE = <strong><code>DEF\x00GHI</code></strong>, the result is the string <strong>DEF</strong> only :-(. The <strong>François</strong>’s version does insert the <strong>NUL</strong> character between the strings <strong>DEF</strong> and <strong>GHI</strong> !</p>
</li>
<li>
<p dir="auto"><strong>BACKWARD</strong> assertions are NOT correctly supported. E.g. : SEARCH = <strong><code>\A.</code></strong> matches, successively, <strong>all</strong> the characters of the <strong>FIRST</strong> line. With the <strong>François</strong>’s version it only matches the <strong>FIRST</strong> character of the current file</p>
</li>
<li>
<p dir="auto">It doesn’t search and replace characters, which are <strong>outside</strong> the Basic Multilingual Plane (<strong>BMP</strong> ). For instance, <em>in an full <strong>UTF-8</strong> file</em> ( with a <strong>BOM</strong> ), if SEARCH = <strong><code>\x{104A5}\x{20AC}</code></strong> and REPLACE = <strong><code>\x{A3}\x{10482}</code></strong>, The present regex engine answers <strong>Invalid regular expression</strong> ! as for the <strong>François</strong>’s version does the replacement <strong>correctly</strong> !</p>
</li>
</ul>
<p dir="auto">Remark :</p>
<p dir="auto">Of course, for that <strong>specific</strong> S/R, you need a <strong>font</strong>, that can display the <strong>Osmanya</strong> characters, and which is affected as the <strong>default style</strong> font, in the <strong>Style Configurator…</strong> dialogue ! To that purpose, download the <strong>Andagii</strong> font at :</p>
<p dir="auto"><a href="http://www.i18nguy.com/unicode/unicode-font.html" rel="nofollow ugc">http://www.i18nguy.com/unicode/unicode-font.html</a></p>
<p dir="auto">and have a look to <strong>Osmanya</strong> characters at :</p>
<p dir="auto"><a href="http://www.unicode.org/charts/PDF/U10480.pdf" rel="nofollow ugc">http://www.unicode.org/charts/PDF/U10480.pdf</a></p>
<ul>
<li>
<p dir="auto">Now, let’s suppose, for instance, the <strong>French</strong> subject string <strong>“Un événement”</strong>, on a <strong>new</strong> line, and the simple SEARCH regex <strong><code>\w</code></strong>. After a click on the <strong>Find Next</strong> button, close the Replace dialog, and keep on searching some <strong>word</strong> characters, by hitting the <strong>F3</strong> key. When you’re, about, at the end of the string, just go searching <strong>backwards</strong>, by hitting the <strong>SHIFT + F3</strong> key. You’ll notice _that it CAN’T go backwards, <strong>past</strong> the <strong>é</strong> character !!!. The <strong>François</strong>’s version  does works well, in <strong>both</strong> directions !</p>
</li>
<li>
<p dir="auto">A <strong>last</strong> example : if you try to <strong>mark</strong> the matches of the simple SEARCH regex <strong><code>(?&lt;=.).</code></strong>, the present regex engine marks any character, <strong>EVERY OTHER</strong> time. With the <strong>François</strong>’s version, it <strong>correctly</strong> find all characters, except for the <strong>very first</strong> of each line !</p>
</li>
<li>
<p dir="auto"><strong>François-R Boyer</strong> also created a new option <strong>SCFIND_REGEXP_LOCALEORDER</strong>, to get ranges of characters, in a <strong>locale</strong> order, NOT in <strong>Unicode</strong> order. For instance, the regex range <strong><code>[A-B]</code></strong>, <em>with the <strong>Match case</strong> option SET</em>, would match all the following characters <strong>AÀÁÂÃÄÅĀĂĄǍǺẠẢẤẦẨẪẬẮẰẲẴẶǼB</strong>, in a true <strong>UTF-8</strong> file, with a suitable font !</p>
</li>
<li>
<p dir="auto">To end with, the <strong>François-R Boyer</strong>’s version could display the <strong>EXACT error</strong> messages, instead of the generic message <strong>Invalid regular expression</strong>. For instance, the regex <strong><code>(\d+ab</code></strong> would report the <strong>Unmatched marking parenthesis</strong> error message !</p>
</li>
</ul>
<hr />
<p dir="auto">So, if you <strong>install</strong> the improved <strong>François-R Boyer</strong> version, of the <strong>BOOST</strong> regex engine, you’ll get some <strong>strong new</strong> features :</p>
<ul>
<li>
<p dir="auto">Search is performed in true <strong>32 bits</strong> code-points, so it can handle characters, <strong>over the BMP</strong> ( Basic Multilingual Plane ). An interesting feature for most <strong>Asiatic</strong> people !</p>
</li>
<li>
<p dir="auto">It can manage <strong>NUL</strong> characters, both, in <strong>search</strong> and <em>in <strong>replacement</strong></em>, too.</p>
</li>
<li>
<p dir="auto"><strong>Look-behinds</strong> are correctly handled, even in case of <strong>OVERLAPPING</strong>, with the end of the <strong>previous</strong> match.</p>
</li>
<li>
<p dir="auto">It can handle <strong>ALL</strong> the Universal Character Names ( <strong>UCN</strong>) of the <strong>UCS Transformation Format</strong> , from <strong><code>\x{0}</code></strong> to <strong><code>\x{7FFFFFFF}</code></strong>, particularly, all those of code-points over <strong><code>\x{FFFF}</code></strong>, which are outside the <strong>BMP</strong>.</p>
</li>
<li>
<p dir="auto">The <strong>backward</strong> regex search isn’t <strong>stopped</strong>, on matching a character, with <strong>Unicode</strong> code-point over <strong><code>\x{007F}</code></strong></p>
</li>
</ul>
<p dir="auto">Of course, the <strong>LOCALE order</strong> and <strong>ERROR messages</strong> new features will <strong>NOT</strong> be accessible, still, in <strong>current</strong> Notepad++ user interface !</p>
<hr />
<p dir="auto"><strong>VERY IMPORTANT</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>Beta N++ regex</strong> code, of <strong>François-R Boyer</strong> <strong>DO NOT</strong> work, will <strong>all</strong> versions of N++, <strong>AFTER</strong> the <strong>6.9.0</strong> version !</p>
<ul>
<li>So, download, <strong>first</strong>, the <strong>.zip</strong> or <strong>.7z</strong> archive of Notepad++ <strong>v6.9.0</strong>, from the link, below :</li>
</ul>
</li>
</ul>
<p dir="auto"><a href="https://notepad-plus-plus.org/download/v6.9.html" rel="nofollow ugc">https://notepad-plus-plus.org/download/v6.9.html</a></p>
<ul>
<li>
<p dir="auto"><strong>Extract all</strong> the contents in <strong>any</strong> folder, in order to get a <strong>local</strong> N++ installation :-))</p>
<ul>
<li>Inside this <strong>new</strong> folder, rename The <strong>SciLexer.dll</strong> file as, for instance, <strong><code>SciLexer.xxx</code></strong></li>
</ul>
</li>
<li>
<p dir="auto">Then, to get this <strong>Beta N++ regex code</strong> ( that has <strong>NEVER</strong> been part of <strong>ANY official</strong> N++ release ) :</p>
<ul>
<li>Download, from the link below, the modified <strong>SciLexer.dll</strong> file. of <strong>François-R Boyer</strong></li>
</ul>
</li>
</ul>
<p dir="auto"><a href="http://sourceforge.net/projects/npppythonplugsq/files/Beta%20N%2B%2B%20regex%20code/" rel="nofollow ugc">http://sourceforge.net/projects/npppythonplugsq/files/Beta N%2B%2B regex code/</a></p>
<ul>
<li>Copy this file, in the <strong>installation</strong> folder, along with the <strong>Notepad++.exe</strong> and the <strong><code>SciLexer.xxx</code></strong> files</li>
</ul>
<pre><code>- Download, too, the **readme.txt** file
</code></pre>
<p dir="auto">Enjoy it !</p>
<p dir="auto"><strong>REMARK</strong> :</p>
<p dir="auto">Remember that this modified <strong>SciLexer.dll</strong>, build on <strong>May 2013</strong>, <em>is based on <strong>Scintilla v2.2.7</strong> !</em></p>
<hr />
<p dir="auto">Of course, I <strong>long for</strong>, ( since more than <strong>3 years</strong> ! ), that this version would be <strong>fully</strong> integrated with, <strong>both</strong>, the <strong>latest</strong> version of <strong>N++</strong> and <strong>Scintilla</strong>. Unfortunately, up to now, <strong>NO ONE</strong> feels interesting to implement the <strong>new regex François-R Boyer</strong>’s code and, as my <strong>C++ skills</strong> are, unfortunately, rather, near <strong>0</strong>, you and me, just, have to content ourselves with using the <strong>present bugged</strong> N++ regex code :-((</p>
<p dir="auto">In the meanwhile, I keep, in addition to the <strong>last</strong> N++ version, a local installation of N++ <strong>v6.9</strong> , with the <strong>François-R Boyer</strong> modified version of <strong>SciLexer.dll</strong>, on my laptop, in order to gsee the <strong>correct</strong> search behaviour of some regexes or to perform, from time to time, <strong>special</strong> replacements ;-)</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">You may verify, that using the <strong>François-R Boyer</strong>’s version, with the <strong>second</strong> formulation, of my regex, below ( <strong>without</strong> the <strong>\K</strong> syntax ) :</p>
<p dir="auto">SEARCH <strong><code>(?-s)((?&lt;=\t)|, )(.+?)(?=, (?:.+, )?\2(, |\R))|(?&lt;=\t),[ ]</code></strong></p>
<p dir="auto">REPLACE <strong>Let <code>EMPTY</code></strong></p>
<p dir="auto">The <strong>replacement-suppression</strong> of all the <strong>duplicate</strong> words, after the <strong>tabulation</strong> character, as well as any string <strong>comma + space</strong>, located after the <strong>tabulation</strong>, are quite effective :-))</p>
<p dir="auto">Unfortunately, if your regex contains the <strong><code>\K</code></strong> syntax, it will <strong>NOT</strong> be good, <strong>even</strong> with the <strong>François-R Boyer</strong>’s version :-((</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19743</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19743</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 06 Dec 2016 21:21:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Mon, 05 Dec 2016 04:12:08 GMT]]></title><description><![CDATA[<p dir="auto">Hi <strong>guy038</strong>,<br />
Thank you for your explanation.</p>
<ul>
<li>
<p dir="auto">You’re right, we shall press <strong>Replace All</strong> button twice. I didn’t notice that the <code>\t</code> had been replaced with <strong>4 spacebars</strong> (by the website I guess) in the <strong>sample original text</strong> in your last reply.<br />
My bad.</p>
</li>
<li>
<p dir="auto">I <strong>AM</strong> aware of  the look behind thing of NP++ (that it has to be length-fixed), and I’m not using <code>(?&lt;=.......)</code> or <code>(?&lt;=.......)</code> in my regex. The <code>&lt;</code> and <code>&gt;</code> in my regex are just literal characters.<br />
So, do you mean the BUG is caused by the presence of <code>\K</code> syntax (in that you said, “when any of these three syntaxes is contained”)? Then why does your regex behave correctly? There is also a <code>\K</code> there.<br />
<strong>PS:</strong> I just tried your regex again, pressing <strong>Replace</strong> button once a time, and it was totally correct.</p>
</li>
</ul>
<p dir="auto">How the hell, does the <code>\K</code> from, have anything to do with the <strong>Replace</strong> and <strong>Replace All</strong> button? I’m so confused:</p>
<ol>
<li>It seems that, in NP++, <strong>Replace All</strong> doesn’t mean repeated <strong>Replace</strong>. Is that intended(maybe implemented with separate functions), or shall we regard it as a BUG?</li>
<li>If we only look at the <strong>Replace</strong> button, why is it, that, the program <strong>CAN</strong> do the right selection, but <strong>CANNOT</strong> simply replace the selected string with an empty string? If that <strong>IS</strong> a BUG, I believe it will be an easy-to-fix one.</li>
</ol>
<p dir="auto">Best!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19692</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19692</guid><dc:creator><![CDATA[古旮]]></dc:creator><pubDate>Mon, 05 Dec 2016 04:12:08 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Sun, 04 Dec 2016 20:28:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>glossar</strong>, <strong>古旮</strong> and <strong>All</strong>,</p>
<p dir="auto">Many thanks, <strong>glossar</strong>, for the ( virtual ) <strong>chocolate</strong> ! Actually, we have <strong>coffee</strong>, after a nice lunch, at my <strong>sister</strong> and <strong>brother-in-law</strong>’s home, this week-end :-) Never mind  ! I hope you spent a nice <strong>week-end</strong>, too !</p>
<p dir="auto">Let’ go back to “work” :-)) Just a couple of <strong>precisions</strong> about my regex :</p>
<ul>
<li>
<p dir="auto"><strong>glossar</strong> and <strong>古旮</strong>, you may have thought that the <strong>first</strong> S/R did the job <strong>completely</strong> However, if you’re curious, you’ll remark that after this <strong>first</strong> S/R, there remains a <strong>comma</strong> and a <strong>space</strong>, located… right after the <strong>tabulation</strong> character ! So, to be exact, I’ve added, at the <strong>end</strong> of the <strong>main</strong> regex <strong><code>(?-s)(\t\K|, )(.+?)(?=, (?:.+, )?\2(, |\R))</code></strong> an alternative (<strong><code>|</code></strong> ) and a second simple regex <strong><code>(?&lt;=\t),[ ]</code></strong>, which is <strong>only</strong> performed, when you click the <strong>Replace All</strong> button, the <strong>second</strong> time !</p>
</li>
<li>
<p dir="auto"><strong>古旮</strong>, it’s very well-known that the <strong>present</strong> N++ regex engine does <strong>NOT</strong> handle the <strong>look-behind</strong> features, especially, in case of <strong>overlapping</strong> strings, which belongs, for <strong>one</strong> part, to the <strong>look-behind</strong> and, for the <strong>other</strong> part, to the <strong>main</strong> regex to search for ! As a consequence :</p>
<ul>
<li>
<p dir="auto">Some matches may be found, by <strong>error</strong>, or, the opposite, <strong>not</strong> found, at all, by the regex engine, when using <strong>look-behinds</strong></p>
</li>
<li>
<p dir="auto">One <strong>CANNOT</strong> use the <strong>Replace</strong> button, but, <strong>EXCLUSIVELY</strong>, the <strong>Replace All</strong> button, when your regex contains, at least, one of these <strong>three</strong> following syntaxes :</p>
<ul>
<li>
<p dir="auto">A <strong>positive</strong> look-behind <strong><code>(?&lt;=.......)</code></strong></p>
</li>
<li>
<p dir="auto">A <strong>negative</strong> look-behind <strong><code>(?&lt;!.......)</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>\K</code></strong> form, which <strong>resets</strong> the <strong>location</strong> of the searched regex. So, the part before the <strong><code>\K</code></strong> syntax, have to be matched, but, due to the <strong>reset</strong> action, the final regex to search for, is ONLY the part, located <strong>AFTER</strong> <strong><code>\K</code></strong>.<br />
In addition, the <strong><code>\K</code></strong> feature allows to <strong>“simulate”</strong> a <strong>non-fixed</strong> length look-behind ( as, for instance, the look-behind <strong><code>(?&lt;=.+a)test</code></strong> or <strong><code>(?&lt;=a|bc|def)test</code></strong>, which are <strong>invalid regular</strong> expressions ! ) With the <strong><code>\K</code></strong> syntax, you would just have to change these <strong>two</strong> regexes, respectively, into <strong><code>.+a\Ktest</code></strong> and <strong><code>(a|bc|def)\Ktest</code></strong> !!</p>
</li>
</ul>
</li>
</ul>
</li>
<li>
<p dir="auto">BTW, <strong>古旮</strong>, I, personally, prefer to perform a <strong>neat</strong> S/R, by moving <strong>back</strong> to the <strong>very beginning</strong> of the current file AND <strong>unchecking</strong> the <strong>wrap around</strong> option Indeed, just imagine that your regex deals with <strong>beginning</strong> of line ( <strong><code>^</code></strong> ) and that you let the caret in a <strong>middle</strong> of a line ! Luckily, most of a time, it doesn’t matter and you just can do as you like to. As for me, I prefer to avoid any <strong>unpredictable</strong> result :-))</p>
</li>
</ul>
<hr />
<ul>
<li>
<p dir="auto">This regex <strong>begins</strong> with the syntax <strong><code>(?-s)</code></strong> which forces the regex engine to see the <strong>dot</strong> meta-character as any <strong>single standard</strong>  character, only</p>
</li>
<li>
<p dir="auto">Then the part <strong><code>(\t\K|, ) is the **group 1** which </code></strong> looks for, <strong>either</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>tabulation</strong> character and <strong>resets</strong> the position of the regex engine</p>
</li>
<li>
<p dir="auto">A <strong>comma</strong>, followed by a <strong>space</strong> character</p>
</li>
</ul>
</li>
<li>
<p dir="auto">The following part <strong><code>(.+?)</code></strong> represents <strong><code>&lt;expression&gt;</code></strong>, discussed in previous post, so any range of characters, between the <strong>two</strong> characters <strong><code>comma + space</code></strong>, stored in <strong>group 2</strong></p>
</li>
<li>
<p dir="auto">The part <strong><code>(?=, (?:.+, )?\2(, |\R))</code></strong> is a condition, called a positive <strong>look-ahead</strong>, which had to be <strong>true</strong>, in order to valid the <strong>overall</strong> regex</p>
</li>
<li>
<p dir="auto">Inside this <strong>look-ahead</strong>, we find <strong>four</strong> parts :</p>
<ul>
<li>
<p dir="auto">A comma, followed by <strong>space</strong> character</p>
</li>
<li>
<p dir="auto"><strong><code>(?:.+, )?</code></strong> which stands for the <strong>longest possible</strong> range of <strong>standard</strong> characters, followed by a <strong>comma</strong> and a <strong>space</strong> character, located before <strong>group 2</strong>, embedded in a <strong>non-capturing</strong> group</p>
</li>
<li>
<p dir="auto"><strong><code>\2</code></strong> represents the <strong>duplicate</strong> <strong><code>&lt;expression&gt;</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>(, |\R)</code></strong> is the character(s), expected, <strong>after</strong> <strong><code>&lt;expression&gt;</code></strong>, That is to say, the couple <strong>comma + space</strong> OR any kind of <strong>EOL</strong> character</p>
</li>
</ul>
</li>
<li>
<p dir="auto">Finally, the part <strong><code>(?&lt;=\t),[ ]</code></strong>, after the <strong>alternative</strong> symbol ( <strong><code>|</code></strong> ) is taken in account, in the <strong>second</strong> S/R, and searches for the <strong>two</strong> characters <strong>comma + space</strong>, ONLY IF preceded by a <strong>tabulation</strong> character</p>
</li>
<li>
<p dir="auto">As the replacement field is <strong>EMPTY</strong>, any <strong><code>&lt;expression&gt;</code></strong>, that is <strong>duplicated</strong>, further on, in the <strong>same</strong> line, ( <strong>1st</strong> S/R ) or <strong><code>comma + space</code></strong> ( <strong>2nd</strong> S/R ) are <strong>deleted</strong></p>
</li>
</ul>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19686</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19686</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 04 Dec 2016 20:28:58 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Sun, 04 Dec 2016 07:26:42 GMT]]></title><description><![CDATA[<p dir="auto">Guy - You are genius!</p>
<p dir="auto">A warm thank you and a hot chocolate  (well, virtually) for your time, effort and help!</p>
<p dir="auto">I am much grateful to you!</p>
<p dir="auto">Thank you!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19669</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19669</guid><dc:creator><![CDATA[glossar]]></dc:creator><pubDate>Sun, 04 Dec 2016 07:26:42 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Sat, 03 Dec 2016 12:40:01 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 />
It’s genius to select and remove the first occurrence. I tried your solution, and it works perfectly.<br />
According to what I’ve tried out, actually, only <strong>ONE</strong> click on the <strong>Replace All</strong> button is needed. And, if you <strong>Check</strong> the <strong>Wrap around</strong> option, you don’t even need to move the cursor to the very beginning of the file. The regex you gave is very convenient.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19657</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19657</guid><dc:creator><![CDATA[古旮]]></dc:creator><pubDate>Sat, 03 Dec 2016 12:40:01 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Sat, 03 Dec 2016 11:52:26 GMT]]></title><description><![CDATA[<p dir="auto"><strong>glossar</strong>,</p>
<p dir="auto">Well, I succeeded to build a <strong>regex</strong> that does the job ! You’ll just need to run this S/R, <strong>TWICE</strong>, consecutively, :-))</p>
<p dir="auto">To begin with, this regex, which <strong>deletes</strong> any <strong>additional duplicate</strong> expression, after a <strong>tabulation</strong> character, adopts the <strong>four</strong> following <strong>rules</strong> :</p>
<ul>
<li>
<p dir="auto"><strong><code>&lt;expression&gt;</code></strong> refers to <strong>any range</strong> of characters, <strong>surrounded</strong> by the <strong>two</strong> characters <strong><code>comma</code></strong> + <strong><code>space</code></strong></p>
</li>
<li>
<p dir="auto"><strong>ANY</strong> <strong><code>&lt;expression&gt;</code></strong>, located <strong>BEFORE</strong> the <strong>tabulation</strong> character ( <strong><code>\t</code></strong> ), is <strong>NOT</strong> deleted</p>
</li>
<li>
<p dir="auto">If an <strong><code>&lt;expression&gt;</code></strong> is present, <strong>ONE</strong> time, <strong>AFTER</strong> the <strong>tabulation</strong> character, this string is <strong>KEPT</strong></p>
</li>
<li>
<p dir="auto">If an <strong><code>&lt;expression&gt;</code></strong> is present, <strong>SEVERAL</strong> times, <strong>AFTER</strong> the <strong>tabulation</strong> character, <strong>ALL</strong> duplicates, AFTER the <strong>tabulation</strong> character, are <strong>DELETED</strong>, except for the <strong>LAST</strong> occurrence of this <strong><code>&lt;expression&gt;</code></strong>, which is <strong>KEPT</strong></p>
</li>
</ul>
<hr />
<p dir="auto">Therefore :</p>
<ul>
<li>
<p dir="auto">Move back to the <strong>very beginning</strong> of your file ( <strong>CTRL + Origin</strong> )</p>
</li>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog</p>
</li>
<li>
<p dir="auto"><strong>Uncheck</strong>, preferably, the <strong>Wrap around</strong> option</p>
</li>
<li>
<p dir="auto">Select the <strong>Regular expression</strong> search mode</p>
</li>
</ul>
<p dir="auto">SEARCH <strong><code>(?-s)(\t\K|, )(.+?)(?=, (?:.+, )?\2(, |\R))|(?&lt;=\t),[ ]</code></strong></p>
<p dir="auto">REPLACE <strong>Let <code>EMPTY</code></strong></p>
<ul>
<li>Click, <strong>TWICE</strong>, on the <strong>Replace All</strong> button</li>
</ul>
<hr />
<p dir="auto">For instance, from the <strong>original</strong> text, below, with the <strong>tabulation</strong> character after the <strong>first</strong> occurrence of the number <strong>99099</strong> :</p>
<pre><code>12345 word 99099	spring, off-spring, of, off spring, offspring, offsprings, offspring, off, off spring, 12345, offsprings, offspring’s, spring, off, of, ring, off-spring, ring, offspring’s, off-spring, offsprings, of, off spring, spring, offspring, spring, off, off spring, offsprings, offspring’s, off, offspring, ring, of, ring, off-spring, offspring’s, 11011, spring, off-spring, of, of, offsprings, off, ring, offspring, off-spring, 67890, off spring, offsprings, offspring’s, spring, off, off spring, offspring, ring, offspring’s, 99099, off-spring, of, off spring, offspring, ring, spring, off spring, offsprings, offspring, off, offsprings, 67890, offspring’s, offspring’s, spring, of, ring, off-spring, off, 99099
</code></pre>
<p dir="auto">We’ll get, after the <strong>TWO consecutive</strong> S/R, the <strong>final</strong> result :</p>
<pre><code>12345 word 99099	12345, 11011, off spring, offspring, offsprings, 67890, offspring’s, spring, of, ring, off-spring, off, 99099
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">I have <strong>not</strong> time to give you, <strong>presently</strong>, some notes on this regex. May be this evening but rather, <strong>tomorrow evening</strong> !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19656</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19656</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 03 Dec 2016 11:52:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Sat, 03 Dec 2016 10:01:29 GMT]]></title><description><![CDATA[<p dir="auto">I believe I’ve found a bug here. As I’m trying to solve the problem, the text is:<br />
<code>&lt;a&gt;&lt;c&gt;&lt;a&gt;&lt;c&gt;&lt;c&gt;</code> and <strong>Find what:</strong> <code>([[:w:]]+).*\K&lt;\1&gt;</code>, and <strong>Replace with</strong> empty string.<br />
As I press the <strong>Replace</strong> button, the text is not changed at all. It’s just selecting the last <code>&lt;a&gt;</code> and the last <code>&lt;c&gt;</code> back and forth.<br />
However, strangely enough, if I press <strong>Replace All</strong>, it’s working.<br />
Pressing <strong>Replace All</strong> twice transforms the text <code>&lt;a&gt;&lt;c&gt;&lt;a&gt;&lt;c&gt;&lt;c&gt;</code> into <code>&lt;a&gt;&lt;c&gt;</code>.</p>
<p dir="auto">I have no idea why this is happening! Is it just me having this bug??</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19654</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19654</guid><dc:creator><![CDATA[古旮]]></dc:creator><pubDate>Sat, 03 Dec 2016 10:01:29 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Fri, 02 Dec 2016 21:48:00 GMT]]></title><description><![CDATA[<p dir="auto">Hello guy!</p>
<ul>
<li>No, neither before nor after the tabulation is there any  space. In my previous post, I have put the spaces before and after it merely for the visual reason.</li>
<li>Yes, the syntax you have shown is correct: “,SPACEword,”</li>
</ul>
<p dir="auto">The closest solution that I found yesterday was one with “SED” - but I have no idea, what SED is, where and how I would excute the SED-command. I would hence be grateful to you if you build the needed regex I could use with Notepad. Together with your previous one that you have recently built for me, this would completely cover my regex needs related to updating and maintaining my glossaries with Notepad.</p>
<p dir="auto">Again, thank you in advance for your help!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19648</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19648</guid><dc:creator><![CDATA[glossar]]></dc:creator><pubDate>Fri, 02 Dec 2016 21:48:00 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove duplicate words in a line using Notepad++? on Fri, 02 Dec 2016 20:07:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>glossar</strong>,</p>
<p dir="auto"><strong>TWO</strong> simple questions, before building the <strong>correct</strong> regex :</p>
<ul>
<li>
<p dir="auto">Are there <strong>one</strong> or <strong>several space</strong> character(s), <strong>after</strong> the <strong>tabulation</strong> ( <strong><code>\t</code></strong> )  character ?</p>
</li>
<li>
<p dir="auto">Is each <strong>word</strong>, of your <strong>list</strong>, in a line, always written, with the syntax <strong><code>, word, </code></strong>, that is to say with the string <strong>comma + space</strong>, <strong>before</strong> AND <strong>after</strong> each <strong>word/string</strong>, except, of course, for the <strong>first</strong> word ( due to the <strong>tabulation</strong> ) and the <strong>last</strong> word ( due to the <strong>line-breack</strong> ) ?</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/19644</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/19644</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 02 Dec 2016 20:07:58 GMT</pubDate></item></channel></rss>