<?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 both duplicates regexp macro?]]></title><description><![CDATA[<p dir="auto">how could I do it?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16489/delete-both-duplicates-regexp-macro</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 16:02:26 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16489.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 Oct 2018 19:54:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 25 Oct 2018 12:52:10 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>,</p>
<p dir="auto">Do you have more to say on this topic?  I’m interested…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35724</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35724</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Thu, 25 Oct 2018 12:52:10 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Wed, 24 Oct 2018 13:42: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> said:</p>
<blockquote>
<p dir="auto">So, guys, if you don’t mind, I would like you to test the regex C , with the first test file, above, in order to verify if it is “laptop-dependent”. I means, may be, results are not pertinent with my weak Windows XP configuration !?</p>
</blockquote>
<p dir="auto">I did this and obtained exactly the same results as you did, <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>.  Specifically, OK with 21524 identical lines, and NOT OK with 21525 identical lines.  I tried both the shorter and longer versions of those “middle” lines in the file.  All this using Notepad++ 7.2.2, 32-bit.  I doubt that any other (reasonable) version of Notepad++ will show different results.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35684</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35684</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Wed, 24 Oct 2018 13:42:11 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Wed, 24 Oct 2018 13:12:08 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:</p>
<blockquote>
<p dir="auto">I’m looking for the results of your own tests, relative to the biggest block of consecutive identical lines, correctly handled by the six regexes A to F, above, and the test file, below</p>
</blockquote>
<p dir="auto">So it might be worth pointing out a good method for creating an arbitrary (i.e., large!) number of the <code>abcdefghij#9999999999</code> lines in your request.</p>
<p dir="auto">Here’s what I would do:</p>
<ul>
<li>put caret on that line in a tab created for the purpose of testing this</li>
<li>start macro recording</li>
<li>press ctrl+d (to execute the <strong>Duplicate Current Line</strong> function)</li>
<li>stop macro recording</li>
<li>go to the <strong>Macro</strong> menu and choose <strong>Run a Macro Multiple Times…</strong></li>
<li>fill in the prompt box entries and press <strong>Run</strong> (to create the desired number of lines)</li>
</ul>
<p dir="auto">To see how many lines of this type you’ve currently got, simply do a literal <strong>Count</strong> search for <code>abcdefghij#9999999999</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35679</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35679</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Wed, 24 Oct 2018 13:12:08 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Wed, 24 Oct 2018 11:28:57 GMT]]></title><description><![CDATA[<p dir="auto">(?-s)^(.+#).<em>\R(\1.</em>\R)+ doesn’t work for my case,<br />
it doesn’t find any occurrences</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35669</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35669</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Wed, 24 Oct 2018 11:28:57 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Tue, 23 Oct 2018 22:58:37 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 />
off topic regarding garden work:<br />
if your garden is as detailed and thorough as everything else you do, i’d gladly invite you to help me out in mine … the amount of daily magnolia leafs to collect is currently killing me this year and i’ve not been able to control my rakes and brooms with an adequate, repeatable regex ;-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35659</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35659</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Tue, 23 Oct 2018 22:58:37 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Mon, 29 Oct 2018 19:21:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>All</strong>,</p>
<p dir="auto">Sorry for the <strong>delay</strong>, but I was busy with some <strong>garden</strong> work (hedge trimming !) and, of course, I also tested the <strong>6</strong> regex, from <strong><code>A</code></strong> to <strong><code>F</code></strong>, of my <strong>previous</strong> post !</p>
<p dir="auto">I used the following <strong>test</strong> file :</p>
<pre><code class="language-diff">a#9999999999
a#9999999999
abcdefghij#9999999999
.........................
.........................
..21524 IDENTICAL lines ( in totality ! )
.........................  
.........................  
abcdefghij#9999999999
z#9999999999
z#9999999999
</code></pre>
<p dir="auto">As you can see :</p>
<ul>
<li>
<p dir="auto">It begins with the <strong><code>2</code></strong> <strong>identical</strong> lines <strong><code>a#9999999999</code></strong></p>
</li>
<li>
<p dir="auto">Then, followed with <strong><code>21524</code></strong> <strong>identical</strong> lines <strong><code>abcdefghij#9999999999</code></strong></p>
</li>
<li>
<p dir="auto">And it finished with the <strong><code>2</code></strong> <strong>identical</strong> lines <strong><code>z#9999999999</code></strong>, followed with a final <strong>line-break</strong></p>
</li>
</ul>
<hr />
<p dir="auto">So, I ran the regex <strong>C</strong> of my <strong>previous</strong> post, ( <strong><code>(?-s)^(.+#).*\R(\1.*\R)+</code></strong> ), against this <strong>test</strong> file</p>
<p dir="auto">=&gt; It <strong>correctly</strong> matched the <strong><code>2</code></strong> lines, at <strong>beginning</strong> of file, then the <strong><code>21524</code></strong> <strong>identical</strong> lines ( =&gt; a selection of <strong><code>495,103</code></strong> characters ) and, the <strong><code>2</code></strong> lines at the <strong>end</strong> of the file</p>
<p dir="auto">Then, I simply added <strong><code>ONE</code></strong> additional line <strong><code>abcdefghij#9999999999</code></strong> to that file and ran the regex again. This time, it matched the <strong><code>2</code></strong> lines, at <strong>beginning</strong> of file, but <strong>wrongly</strong> grabbed all <strong>remaining</strong> text ( So the <strong><code>21525</code></strong> lines AND the <strong><code>2</code></strong> last lines ) !?</p>
<p dir="auto">To verify if the results depended of the <strong>size</strong> of the selection, I changed the <strong>test</strong> file,with lines of <strong><code>140</code></strong> chars, as below :</p>
<pre><code class="language-diff">a#9999999999
a#9999999999
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz#9999999999999999999999999999999999999999999999999999999999999999999999999999999999999
.........................
.........................
..21524 IDENTICAL lines ( in totality ! )
.........................  
.........................  
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz#9999999999999999999999999999999999999999999999999999999999999999999999999999999999999
z#9999999999
z#9999999999
</code></pre>
<p dir="auto">I was very <strong>surprised</strong> to see that results were <strong>exactly</strong> the <strong>same</strong> ( <strong>OK</strong> for <strong><code>21524</code></strong> <strong>identical</strong> lines and <strong>KO</strong> for <strong><code>21525</code></strong> <strong>identical</strong> lines !!?? ) And <strong>yet</strong>, this time, the selection contained <strong><code>3,013,360</code></strong> chars !</p>
<p dir="auto">Of course, I did this test with <strong>all</strong> the <strong>other</strong> regexes. For example, with regex <strong>A</strong>, the limit is a bit <strong>higher</strong> : <strong><code>25120</code></strong> lines. But again, after adding <strong>one more</strong> line, the regex <strong><code>A</code></strong> failed :-((</p>
<p dir="auto">So, guys, if you don’t mind, I would like you to <strong>test</strong> the regex <strong>C</strong> , with the <strong>first</strong> test file, above, in order to verify if it is <strong>“laptop-dependent”</strong>. I means, may be, results are not <strong>pertinent</strong> with my weak <strong>Windows XP</strong> configuration !?</p>
<p dir="auto">In the meanwhile , seemingly, we can conclude that, in a previously <strong>sorted</strong> file, a <strong>regular</strong> expression can handle, <strong>roughly</strong>, not more than <strong><code>21,000</code></strong> <strong>identical</strong> lines, at a <strong>time</strong> ! I’d be glad to receive your feed-back in order to <strong>confirm</strong> or <strong>invalidate</strong> this fact :-))</p>
<hr />
<p dir="auto">Of course, I came to this <strong>temporary</strong> conclusion, after testing my <strong>6</strong> regexes, from <strong><code>A</code></strong> to <strong><code>F</code></strong>, against <strong>real</strong> text. I decided to take <strong>all</strong> contents of a <strong>novel</strong>, on the <strong>Gutenberg</strong> site. And…, as I’m <strong>French</strong>, my choice was, naturally, the novel <strong>“The count of Monte-Cristo”</strong> by <strong>Alexandre Dumas</strong>, that you may download from the link below:</p>
<p dir="auto"><a href="http://www.gutenberg.org/files/1184/1184-0.txt" rel="nofollow ugc">http://www.gutenberg.org/files/1184/1184-0.txt</a> ( Choose the link “<strong>Raw text UTF-8</strong>” )</p>
<p dir="auto">When I first tried to build a suitable <strong>sorted</strong> working file, in order to <strong>test</strong> my regexes, unfortunately, all <strong>failed</strong> :-(( But I also noticed, in that <strong>sorted</strong> file, that there were <strong>numerous</strong> lines <strong><code>the#.....</code></strong>. Indeed, if you download the novel, just count the occurrences of the regex <strong><code>\bthe\b</code></strong> =&gt; <strong><code>28628</code></strong> occurrences of the article <strong>“the”</strong>. So I <strong>deleted</strong> all these <strong>consecutive</strong> occurrences of the word <strong>“the”</strong>. This time <strong>all</strong> my regexes worked as <strong>expected</strong> :-))</p>
<p dir="auto">However, note that, during my tests, I found out that my regexes <strong><code>D</code></strong> to <strong><code>F</code></strong> were, initially, <strong>erroneous</strong>. So I changed them, and I already <strong>updated</strong> my <strong>previous</strong> post with the <strong>correct</strong> regexes !</p>
<hr />
<p dir="auto">With the help of that page, below, on the <strong>most common</strong> words in <strong>English</strong> :</p>
<p dir="auto"><a href="https://en.wikipedia.org/wiki/Most_common_words_in_English" rel="nofollow ugc">https://en.wikipedia.org/wiki/Most_common_words_in_English</a></p>
<p dir="auto">I verified, with the regex <strong><code>\b</code>Word<code>\b</code></strong>, that, in <strong>this</strong> novel, the <strong><code>10</code></strong> <strong>most common</strong> words used, in the <strong>initial</strong> text, are :</p>
<pre><code class="language-diff">the          28,628  ( ABSENT in the SORTED file )
to           12,897
of           12,916
and          12,570
a             9,473
I             8,393
you           8,288
he            6,945
in            6,625
his           5,909
</code></pre>
<p dir="auto">So, we are sure that the <strong><code>6</code></strong> regexes can, at least, manage files containing up to <strong><code>13,000</code></strong> <strong>consecutive identical</strong> lines !</p>
<hr />
<p dir="auto">Now, if some people is <strong>interested</strong> about the different <strong>steps</strong>, that I used to constitute a <strong>decent</strong> working file, for testing regexes <strong><code>A</code></strong> to <strong><code>F</code></strong>, just have a glance to the table, below :</p>
<pre><code class="language-diff">•------------------------------------•---------------•-----------------------------------------------------------------------------------------------------•-------------• 
|            SEARCH                  |    REPLACE    |                                       EXPLANATIONS                                                  | Occurrences |
•------------------------------------•---------------•-----------------------------------------------------------------------------------------------------•-------------•
|                                    |               | We delete, manually, from BEGINNING of file to the END of the CONTENTS part                         |             |
|                                    |               |                                                                                                     |             |
|                                    |               | We delete, manually, from AFTER the FOOTNOTES part till the VERY END of file                        |             |
|                                    |               |                                                                                                     |             |
| ,(?=\d)                            |    EMPTY      | We delete any COMMA separator in NUMBERS                                                            |       264   |
|                                    |               |                                                                                                     |             |
| [,;.]                              | \x20          | We change any punctuation END of a (part of) SENTENCE with a SPACE character                        |    72,423   |
|                                    |               |                                                                                                     |             |
| (?i)o’(?=clock)                    | of\x20the\x20 | We replace the "o’" CONTRACTIVE form with the COMPLETE form "of the "                               |       164   |
|                                    |               |                                                                                                     |             |
| (?i)’s|(?&lt;!\w)’|’(?!\w)            |    EMPTY      | We delete the "’s" string and any "’" sign NOT SURROUNDED with WORD chars                           |     2,754   |
|                                    |               |                                                                                                     |             |
| (?i)(d|l)’                         | \1e\x20       | We change the "d’" and "l’" French CONTRACTIVE forms to, RESPECTIVELY, "de " and "le "              |       311   |
|                                    |               |                                                                                                     |             |
| —|-                                | \x20          | We change any HYPHEN-MINUS character as well as the EM DASH char, with a SPACE character            |     4,933   |
|                                    |               |                                                                                                     |             |
| [^\w’\r\n ]                        | \x20          | We ONLY keep WORD, SPACE, and EOL characters and the ’ sign( PRESENT in English CONTRACTIVE forms ) |    38,795   |
|                                    |               |                                                                                                     |             |
| (?-i)(?&lt;=\s)(?=\w)[^aAIVX\d](?=\s) | \x20          | As ONE-char STRING, we ONLY keep article "A", "a", pronoun "I", DIGITS and ROMAN letters "V" , "X"  |     1,151   |
|                                    |               |                                                                                                     |             |
| ^\h*\R|^\h+|\h+$|\h+(?=\h)         |    EMPTY      | We delete PURE BLANK lines, TRIM spaces at START and END, and REDUCE to a ONE SPACE gap             |   107,108   |
|                                    |               |                                                                                                     |             |
| \x20          ( &gt; 1 mn ! )         | \r\n          | Finally, we change any SINGLE SPACE character with a LINE BREAK                                     |   419,769   |
|                                    |               |                                                                                                     |             |
| COLUMN editor, with LEADING zeros  |               | At LINE 1, COLUMN 1                                                                                 |             |
|                                    |               |                                                                                                     |             |
| (?-s)^(\d{6})(.+)                  | \2#\1         | We SWAP each WORD and its REFERENCE number                                                          |   464,233   |
|                                    |               |                                                                                                     |             |
| (?i)^the#                          |               | We BOOKMARK all the LINES, containing the article "the", whatever its CASE                          |    28,529   |
|                                    |               |                                                                                                     |             |
| Bookmark &gt; Cut Bookmarked Lines    |               | We BACKUP all these lines in an OTHER file, for FURTHER processing                                  |             |
|                                    |               |                                                                                                     |             |
| Sort lines Lexico... ASCENDING     |               | =&gt; A work SORTED file, encoded UTF-8 with BOM, of 5,861,424 BYTES, with 435,704 WORDS, ONE per line |             |
|                                    |               |                                                                                                     |             |
•------------------------------------•---------------•-----------------------------------------------------------------------------------------------------•-------------•
</code></pre>
<hr />
<p dir="auto">Now, applying the regexes <strong><code>A</code></strong> to <strong><code>F</code></strong>, against the <strong>sorted</strong> file obtained, I got, after <strong><code>10s</code></strong> about for each, the <strong>coherent</strong> results, below :</p>
<pre><code class="language-z">
•-------•---------------------------------------•----------•-------------•--------------•
| Regex |                SEARCH                 |  REPLACE | Occurrences | LINES Number |
•-------•---------------------------------------•----------•-------------•--------------•
|       |    Work SORTED file, obtained, AFTER all the steps above :     |    435,704   |
•-------•---------------------------------------•----------•-------------•--------------•
|       |                                       |          |             |              |
|   A   |  (?-s)^(.+#).*\R(?:\1.*\R)+           |  EMPTY   |    10,818   |      6,861   |
|       |                                       |          |             |              |
|   B   |  (?-s)^((.+#).*\R)(?:\2.*\R)+         |  \1      |    10,818   |     17,679   |
|       |                                       |          |             |              |
|   C   |  (?-s)^(.+#).*\R(\1.*\R)+             |  \2      |    10,818   |     17,679   |
|       |                                       |          |             |              |
|   D   |  (?-s)^(.+#).*\R(?:\1.*\R)+|.+\R      |  ?1$0    |    17,679   |    428,843   |
|       |                                       |          |             |              |
|   E   |  (?-s)^((.+#).*\R)(?:\2.*\R)+|.+\R    |  \1      |    17,679   |     10,818   |
|       |                                       |          |             |              |
|   F   |  `(?-s)^(.+#).*\R(\1.*\R)+|.+\R	    |  \2      |    17,679   |     10,818   |
|       |                                       |          |             |              |
•-------•---------------------------------------•----------•-------------•--------------•
</code></pre>
<p dir="auto">It’s easy to verify that :</p>
<ul>
<li>
<p dir="auto"><strong><code>6,861</code></strong> lines, after regex <strong><code>A</code></strong> + <strong><code>428,843</code></strong> lines, after regex <strong><code>D</code></strong> = <strong><code>435,704</code></strong> ( <strong>Total</strong> of the file )</p>
</li>
<li>
<p dir="auto"><strong><code>6,861</code></strong> lines, after regex <strong><code>A</code></strong>, + <strong><code>10,818</code></strong> lines, after regex <strong><code>E </code></strong> = <strong><code>17,679</code></strong> lines, after regex <strong><code>B</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>6,861</code></strong> lines, after regex <strong><code>A</code></strong>, + <strong><code>10,818</code></strong> lines, after regex <strong><code>F </code></strong> = <strong><code>17,679</code></strong> lines, after regex <strong><code>C</code></strong></p>
</li>
</ul>
<p dir="auto">On the other hand :</p>
<ul>
<li>
<p dir="auto">The <strong><code>10818</code></strong> occurrences of regexes <strong><code>A</code></strong>, <strong><code>B</code></strong> and <strong><code>C</code></strong> correspond to all the <strong>first/last duplicate</strong> lines, as after regexes <strong><code>E</code></strong> or <strong><code>F</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>17,679</code></strong> occurrences of regexes <strong><code>D</code></strong>, <strong><code>E</code></strong> and <strong><code>F</code></strong> correspond to all <strong>first/last duplicate</strong> lines AND all the <strong>uniques</strong> lines, too, as after regexes <strong><code>B</code></strong> or <strong><code>C</code></strong></p>
</li>
</ul>
<p dir="auto">Note also that :</p>
<ul>
<li>
<p dir="auto">With the <strong><code>3</code></strong> regexes <strong><code>A</code></strong>, <strong><code>B</code></strong> and <strong><code>C</code></strong>, the <strong>unique</strong> lines, which must be <strong>kept</strong>, are,simply, <strong>not</strong> processed by the regexes</p>
</li>
<li>
<p dir="auto">With the <strong><code>3</code></strong> regexes <strong><code>D</code></strong>, <strong><code>E</code></strong> and <strong><code>F</code></strong>, the <strong>unique</strong> lines, which must be <strong>deleted</strong>, are matched by the <strong>second</strong> alternative <strong><code>.+\R</code></strong> of the regexes</p>
</li>
</ul>
<hr />
<p dir="auto">So, guys, as I said, above, I’m looking for the results of your <strong>own</strong> tests, relative to the <strong>biggest</strong> block of <strong>consecutive identical</strong> lines, <strong>correctly</strong> handled by the <strong>six</strong> regexes <strong><code>A</code></strong> to <strong><code>F</code></strong>, above, and the <strong>test</strong> file, below :</p>
<pre><code class="language-diff">a#9999999999
a#9999999999
abcdefghij#9999999999         )
.....................         )
.....................         )   HOW MANY lines ? ( THANKS for testing !!)
.....................         )
abcdefghij#9999999999         ]
z#9999999999
z#9999999999
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35657</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35657</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 29 Oct 2018 19:21:03 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Mon, 22 Oct 2018 05:54:43 GMT]]></title><description><![CDATA[<p dir="auto">(?-s)^(.+)\R(?s)(?=.*\R\1\R?)</p>
<p dir="auto">doesn’t match the whole line,<br />
e.g. it tells me that <a href="http://adobe.com" rel="nofollow ugc">adobe.com</a> exists, but I only have lines that end in <a href="http://adobe.com" rel="nofollow ugc">adobe.com</a>, e.g. <a href="http://get.adobe.com" rel="nofollow ugc">get.adobe.com</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/35602</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35602</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Mon, 22 Oct 2018 05:54:43 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 18:12:47 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:</p>
<blockquote>
<p dir="auto">the regex engine ends up , matching, wrongly, all file contents</p>
</blockquote>
<p dir="auto">As mentioned in <a href="https://notepad-plus-plus.org/community/topic/12179/regex-select-everything-before-a-particular-word-included-the-line-with-word" rel="nofollow ugc">this thread</a>, this is in all likelihood caused by <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4761" rel="nofollow ugc">this problem</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35569</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35569</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 19 Oct 2018 18:12:47 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 14:51:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/patrickdrd" aria-label="Profile: patrickdrd">@<bdi>patrickdrd</bdi></a> said:</p>
<blockquote>
<p dir="auto">thanks a lot for your effort, but too much fuss, isn’t it?</p>
</blockquote>
<p dir="auto">NOTHING is too much fuss for <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> !  :-D</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35565</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35565</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 19 Oct 2018 14:51:08 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 13:49:32 GMT]]></title><description><![CDATA[<p dir="auto">thanks a lot for your effort, but too much fuss, isn’t it?</p>
<p dir="auto">vlookup in excel is easier to do I think</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35562</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35562</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Fri, 19 Oct 2018 13:49:32 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Sat, 20 Oct 2018 02:42:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>All</strong></p>
<p dir="auto"><strong>Unfortunately</strong>, again, I verified that my <strong>previous</strong> method  works, only, if file contents and/or number of lines processed are <strong>not</strong> too important :-(( In most cases, the regex engine ends up , matching, <strong>wrongly</strong>, all file contents. Too bad !</p>
<p dir="auto">So, if you wish to keep the <strong>initial</strong> order of your file, here is, a <strong>new</strong> method to adopt, which covers <strong>all</strong> cases ( I hope so ! ), in order to <strong>keep/delete</strong> <strong>duplicate</strong> lines AND/OR all <strong>non-duplicate</strong> lines of a file, whatever its <strong>size</strong> !</p>
<p dir="auto">Please, do <strong>any</strong> test, even on <strong>mportant</strong> files to verify that this method is <strong>robust</strong> and does <strong>not</strong> fail ! I’ll be <strong>glad</strong> to get your <strong>feedback</strong> :-))</p>
<hr />
<p dir="auto">So, let’s start with that <strong>sample</strong> text :</p>
<pre><code class="language-diff">567890
1234
45
1234
xyz
567890
567890
000000000
567890
45
abcdef
1234
1234
45
hijk
45
45
567890
1234
999
1234
</code></pre>
<ul>
<li>
<p dir="auto">Move the cursor at the <strong>beginning</strong> of the <strong>first</strong> item <strong><code>567890</code></strong></p>
</li>
<li>
<p dir="auto">Open the <strong>Column editor</strong> ( <strong><code>Edit &gt; Column Editor...</code></strong> )</p>
</li>
<li>
<p dir="auto">Insert a <strong>decimal</strong> sequence of numbers, ticking the <strong><code>Leading zeros</code></strong> option</p>
</li>
<li>
<p dir="auto"><strong>Delete</strong> the <strong>last isolated</strong> number <strong><code>22</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt;</p>
<pre><code class="language-diff">01567890
021234
0345
041234
05xyz
06567890
07567890
08000000000
09567890
1045
11abcdef
121234
131234
1445
15hijk
1645
1745
18567890
191234
20999
211234
</code></pre>
<ul>
<li>
<p dir="auto">Now, use the regex <strong>S/R</strong>, below, to <strong>swap</strong> the positions of <strong>data</strong> and <strong>numbers</strong>, where <strong>N</strong> is the number of <strong>digits</strong>, of the previous <strong>numbering</strong>, and to insert of a <strong>separation</strong> character ( I chose the <strong><code>#</code></strong> character, but <strong>any</strong> individual char may suit, providing it’s <strong>not</strong> used in your data. Prefer a character which is <strong>not</strong> a <strong>meta-character</strong> used in <strong>regexes</strong>  ! )</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>^(?-s)^(\d{</code>N<code>})(.+)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>\2#\1</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">As, in our example, <strong>N</strong> = <strong><code>2</code></strong>, it leads to the text :</p>
<pre><code class="language-diff">567890#01
1234#02
45#03
1234#04
xyz#05
567890#06
567890#07
000000000#08
567890#09
45#10
abcdef#11
1234#12
1234#13
45#14
hijk#15
45#16
45#17
567890#18
1234#19
999#20
1234#21
</code></pre>
<ul>
<li>Then, execute a <strong>sort</strong> with the menu option <strong><code>Edit &gt; Line Operations &gt; Sort Lines Lexicographically Ascending</code></strong> =&gt;</li>
</ul>
<pre><code class="language-diff">000000000#08
1234#02
1234#04
1234#12
1234#13
1234#19
1234#21
45#03
45#10
45#14
45#16
45#17
567890#01
567890#06
567890#07
567890#09
567890#18
999#20
abcdef#11
hijk#15
xyz#05
</code></pre>
<p dir="auto"><strong>Important</strong> : Till the <strong>end</strong> of that post, this <strong>sorted</strong> text becomes the <strong>new sample</strong> text !</p>
<hr />
<p dir="auto">Now, here are the <strong>six</strong> regex <strong>S/R</strong> that cover <strong>all</strong> possible cases :</p>
<ul>
<li>
<p dir="auto">Regex <strong>A</strong> : SEARCH <strong><code>(?-s)^(.+#).*\R(?:\1.*\R)+</code></strong> and REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
<li>
<p dir="auto">Regex <strong>B</strong> : SEARCH <strong><code>(?-s)^((.+#).*\R)(?:\2.*\R)+</code></strong> and REPLACE <strong><code>\1</code></strong></p>
</li>
<li>
<p dir="auto">Regex <strong>C</strong> : SEARCH <strong><code>(?-s)^(.+#).*\R(\1.*\R)+</code></strong> and REPLACE <strong><code>\2</code></strong></p>
</li>
<li>
<p dir="auto">Regex <strong>D</strong> : SEARCH <strong><code>(?-s)^(.+#).*\R(?:\1.*\R)+|.+\R</code></strong> and REPLACE <strong><code>?1$0</code></strong></p>
</li>
<li>
<p dir="auto">Regex <strong>E</strong> : SEARCH <strong><code>(?-s)^((.+#).*\R)(?:\2.*\R)+|.+\R</code></strong> and REPLACE <strong><code>\1</code></strong></p>
</li>
<li>
<p dir="auto">Regex <strong>F</strong>  : SEARCH <strong><code>(?-s)^(.+#).*\R(\1.*\R)+|.+\R</code></strong> and REPLACE <strong><code>\2</code></strong></p>
</li>
</ul>
<hr />
<p dir="auto">So, in a previously <strong>sorted</strong> file ( I insist ! ) and <strong>whatever</strong> the numbering after the <strong><code>#</code></strong>  symbol :</p>
<ul>
<li>
<p dir="auto">If you want to delete <strong>all duplicate</strong> lines, only, use the regex <strong><code>A</code></strong></p>
</li>
<li>
<p dir="auto">If you want to keep <strong>isolated</strong> lines AND the <strong>first</strong> line of <strong>each</strong> block of <strong>duplicate</strong> lines, only, use the regex <strong><code>B</code></strong></p>
</li>
<li>
<p dir="auto">If you want to keep <strong>isolated</strong> lines AND the <strong>last</strong> line of <strong>each</strong> block of <strong>duplicate</strong> lines, only, use the regex <strong><code>C</code></strong></p>
</li>
<li>
<p dir="auto">If you want to delete <strong>isolated</strong> lines, <strong>only</strong>, use the regex <strong><code>D</code></strong></p>
</li>
<li>
<p dir="auto">If you want to keep the <strong>first</strong> line of <strong>each</strong> block of <strong>duplicate</strong> lines, only, use the regex <strong><code>E</code></strong></p>
</li>
<li>
<p dir="auto">If you want to keep the <strong>last</strong> line of <strong>each</strong> block of <strong>duplicate</strong> lines, only, use the regex <strong><code>F</code></strong></p>
</li>
</ul>
<p dir="auto">Here are, below,  the results of these <strong>six</strong> regex <strong>S/R</strong>, against the <strong>sample</strong> text :</p>
<pre><code class="language-diff">•----------------•----------------•----------------•----------------•----------------•----------------•
|    Regex A     |    Regex B     |    Regex C     |    Regex D     |    Regex E     |    Regex F     |
•----------------•----------------•----------------•----------------•----------------•----------------•
|  000000000#08  |  000000000#08  |  000000000#08  |  1234#02       |  1234#02       |  1234#21       |
|  999#20        |  1234#02       |  1234#21       |  1234#04       |  45#03         |  45#17         |
|  abcdef#11     |  45#03         |  45#17         |  1234#12       |  567890#01     |  567890#18     |
|  hijk#15       |  567890#01     |  567890#18     |  1234#13       |                |                |
|  xyz#05        |  999#20        |  999#20        |  1234#19       |                |                |
|                |  abcdef#11     |  abcdef#11     |  45#03         |                |                |
|                |  hijk#15       |  hijk#15       |  45#10         |                |                |
|                |  xyz#05        |  xyz#05        |  45#14         |                |                |
|                |                |                |  45#16         |                |                |
|                |                |                |  567890#01     |                |                |
|                |                |                |  567890#06     |                |                |
|                |                |                |  567890#07     |                |                |
|                |                |                |  567890#09     |                |                |
•----------------•----------------•----------------•----------------•----------------•----------------•
</code></pre>
<hr />
<ul>
<li>
<p dir="auto">Now, considering any of these <strong><code>6</code></strong> results, just above, let’s <strong>swap</strong>, with the regex <strong>S/R</strong>, below, the <strong>two</strong> blocks of data, on either side of the <strong><code>#</code></strong> character</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>^(?-s)^(.+)#(.+)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>\2#\1</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">We get the <strong>different</strong> cases, below :</p>
<pre><code class="language-diff">•----------------•----------------•----------------•----------------•----------------•----------------•
|    Regex A     |    Regex B     |    Regex C     |    Regex D     |    Regex E     |    Regex F     |
•----------------•----------------•----------------•----------------•----------------•----------------•
|  08#000000000  |  08#000000000  |  08#000000000  |  02#1234       |  02#1234       |  21#1234       |
|  20#999        |  02#1234       |  21#1234       |  04#1234       |  03#45         |  17#45         |
|  11#abcdef     |  03#45         |  17#45         |  12#1234       |  01#567890     |  18#567890     |
|  15#hijk       |  01#567890     |  18#567890     |  13#1234       |                |                |
|  05#xyz        |  20#999        |  20#999        |  19#1234       |                |                |
|                |  11#abcdef     |  11#abcdef     |  03#45         |                |                |
|                |  15#hijk       |  15#hijk       |  10#45         |                |                |
|                |  05#xyz        |  05#xyz        |  14#45         |                |                |
|                |                |                |  16#45         |                |                |
|                |                |                |  01#567890     |                |                |
|                |                |                |  06#567890     |                |                |
|                |                |                |  07#567890     |                |                |
|                |                |                |  09#567890     |                |                |
•----------------•----------------•----------------•----------------•----------------•----------------•
</code></pre>
<ul>
<li>Considering any of these <strong><code>6</code></strong> results, just above, perform, again, a <strong>sort</strong>, with the option <strong><code>Edit &gt; Line Operations &gt; Sort Lines Lexicographically Ascending</code></strong> =&gt;</li>
</ul>
<pre><code class="language-diff">•----------------•----------------•----------------•----------------•----------------•----------------•
|    Regex A     |    Regex B     |    Regex C     |    Regex D     |    Regex E     |    Regex F     |
•----------------•----------------•----------------•----------------•----------------•----------------•
|  05#xyz        |  01#567890     |  05#xyz        |  01#567890     |  01#567890     |  17#45         |
|  08#000000000  |  02#1234       |  08#000000000  |  02#1234       |  02#1234       |  18#567890     |
|  11#abcdef     |  03#45         |  11#abcdef     |  03#45         |  03#45         |  21#1234       |
|  15#hijk       |  05#xyz        |  15#hijk       |  04#1234       |                |                |
|  20#999        |  08#000000000  |  17#45         |  06#567890     |                |                |
|                |  11#abcdef     |  18#567890     |  07#567890     |                |                |
|                |  15#hijk       |  20#999        |  09#567890     |                |                |
|                |  20#999        |  21#1234       |  10#45         |                |                |
|                |                |                |  12#1234       |                |                |
|                |                |                |  13#1234       |                |                |
|                |                |                |  14#45         |                |                |
|                |                |                |  16#45         |                |                |
|                |                |                |  19#1234       |                |                |
•----------------•----------------•----------------•----------------•----------------•----------------•
</code></pre>
<ul>
<li>
<p dir="auto">Finally, let’s use this last regex S/R to get rid of all the <strong>counting marks</strong></p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^.+#</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave Empty</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">We obtain the <strong><code>6</code></strong> <strong>final</strong> results, from the <strong>original</strong> text :</p>
<pre><code class="language-diff">•----------------•----------------•----------------•----------------•----------------•----------------•
|    Regex A     |    Regex B     |    Regex C     |    Regex D     |    Regex E     |    Regex F     |
•----------------•----------------•----------------•----------------•----------------•----------------•
|    xyz         |    567890      |    xyz         |    567890      |    567890      |    45          |
|    000000000   |    1234        |    000000000   |    1234        |    1234        |    567890      |
|    abcdef      |    45          |    abcdef      |    45          |    45          |    1234        |
|    hijk        |    xyz         |    hijk        |    1234        |                |                |
|    999         |    000000000   |    45          |    567890      |                |                |
|                |    abcdef      |    567890      |    567890      |                |                |
|                |    hijk        |    999         |    567890      |                |                |
|                |    999         |    1234        |    45          |                |                |
|                |                |                |    1234        |                |                |
|                |                |                |    1234        |                |                |
|                |                |                |    45          |                |                |
|                |                |                |    45          |                |                |
|                |                |                |    1234        |                |                |
•----------------•----------------•----------------•----------------•----------------•----------------•
</code></pre>
<p dir="auto"><strong>Remark</strong> : This method needs <strong>numerous</strong> steps, but is quite <strong>safe</strong>, because all the <strong>modifications</strong>, produced by the different S/R, concern <strong>one</strong> line <strong>at a time</strong> ( or a <strong>consecutive</strong> block of lines, in regexes <strong>A</strong> to <strong>F</strong> ! )</p>
<p dir="auto">Of course, on <strong>huge</strong> files , execution <strong>time</strong> may be <strong>important</strong>, but you should get the <strong>expected</strong> results, at the end ;-))</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35560</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35560</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 20 Oct 2018 02:42:27 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 10:58:23 GMT]]></title><description><![CDATA[<p dir="auto">this regexp is doing the job fine:</p>
<p dir="auto">(?-s)^(.+)\R(?s)(?=.*\R\1\R?)</p>
<p dir="auto">but as guy said, it doesn’t work with large (or kind of) files,<br />
my file is 1-1,5mb (a bit over 50k records) and it doesn’t work</p>
<p dir="auto">anyway, I did it with excel vlookup function</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35555</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35555</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Fri, 19 Oct 2018 10:58:23 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 09:15:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/patrickdrd" aria-label="Profile: patrickdrd">@<bdi>patrickdrd</bdi></a><br />
that’s the regex I meant. Well if it’s found 3 then at least it works. If you are able to figure out the other 4 lines (you expected to get), then I’d suggest making a new file, copying those 4 lines, and their ‘duplicates’ from the second file and comparing them. To make it easier to compare, use the Show Symbol (under main menu View option). You can select all, or possibly just some of the options. Put 1 line from first file directly above it’s ‘duplicate’ from the second. I bet you will find a difference. It may only be a space, or possibly a tab in one vs a number of spaces in the other line, but there will be a difference.</p>
<p dir="auto">As for different bookmark colors, I know it can be done as @Scott_Sumner mentioned it recently, or rather he mentioned a different icon, so presumably a different colour is also possible. I suggest have a look through his posts. This can be done by selecting a poster (their name in blue), then in their profile page the right hand side lists posts going backwards in time, last at the top.</p>
<p dir="auto">It’s bed time for me. Likely someone else will respond overnight if you are still having issues.</p>
<p dir="auto">Good luck</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35554</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35554</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 19 Oct 2018 09:15:33 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 09:11:56 GMT]]></title><description><![CDATA[<p dir="auto">ok I’ve found about the color here:<br />
<a href="https://notepad-plus-plus.org/community/topic/12631/bookmark-line-color/2" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/12631/bookmark-line-color/2</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/35553</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35553</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Fri, 19 Oct 2018 09:11:56 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 09:04:36 GMT]]></title><description><![CDATA[<p dir="auto">so, which regexp should I use?</p>
<p dir="auto">I tried with this one:</p>
<p dir="auto">(?-s)^(.+)\R(?s)(?=.*\R\1\R?)</p>
<p dir="auto">and it gives me 3 results only (I expected 7) and<br />
how/where do I set bookmark colors in notepad++?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35552</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35552</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Fri, 19 Oct 2018 09:04:36 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 08:45:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/patrickdrd" aria-label="Profile: patrickdrd">@<bdi>patrickdrd</bdi></a><br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> had a post (in response to a similar question). See:<br />
<a href="https://notepad-plus-plus.org/community/topic/15436/subtract-document-b-from-a/4" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/15436/subtract-document-b-from-a/4</a></p>
<p dir="auto">In this one the object was to remove duplicate lines. However you could use the same regex to “Mark” the line. Actually in the Mark function you would also tick “bookmark line”. This should identify all the lines in the first file (which is above the — line stated in that post. The second file would be below that line. Because you aren’t removing any lines the first file needs to have ONLY unique lines for the regex to correctly identify duplicates across the 2 files.</p>
<p dir="auto">Have a go using that. Come back if issues arise. Please note that Notepad++ has issues with large files, so possibly read the remainder of that thread first.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35551</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35551</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 19 Oct 2018 08:45:03 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Fri, 19 Oct 2018 08:24:22 GMT]]></title><description><![CDATA[<p dir="auto">thanks for help guys,<br />
I managed to complete my original task,<br />
but now I’ve got another one,<br />
which should be a bit more difficult:</p>
<p dir="auto">basically the files are two, I join them,<br />
anyway, what I would like to do now is to find out<br />
which lines of the first file exist in the second,<br />
I tried with examdiff I use (trying to compare two sorted files),<br />
but it didn’t return proper results</p>
<p dir="auto">imagine that the first file acts as a “whitelist” against the second file</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35550</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35550</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Fri, 19 Oct 2018 08:24:22 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 18 Oct 2018 23:23:24 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/patrickdrd" aria-label="Profile: patrickdrd">@<bdi>patrickdrd</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">So, if you do <strong>not</strong>  need to give the <strong>initial</strong> order of your data,  it’s quite <strong>easy</strong> !</p>
<p dir="auto">Imagine, for instance, the <strong>initial</strong> text :</p>
<pre><code class="language-diff">789
123
456
123
xyz
789
789
000
789
456
abc
123
123
456
hij
456
456
789
123
999
123
</code></pre>
<p dir="auto">Which gives, after <strong>lexicographically ascending sort</strong> :</p>
<pre><code class="language-diff">000
123
123
123
123
123
123
456
456
456
456
456
789
789
789
789
789
999
abc
hij
xyz
</code></pre>
<ul>
<li>
<p dir="auto">Now, just verify that, AFTER sort, the <strong>last</strong> line of your data is followed with a <strong>pure blank</strong> line</p>
</li>
<li>
<p dir="auto">Then, use the regex <strong>S/R</strong>, below, which will <strong>delete</strong> any <strong>duplicated</strong> line, leaving <strong>isolated</strong> lines, only :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^(.+\R)\1+</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">=&gt; You’ll get, as expected, the <strong>sorted</strong> list of the <strong>isolated</strong> lines :</p>
<pre><code class="language-diff">000
999
abc
hij
xyz
</code></pre>
<hr />
<p dir="auto">Now, if you prefer to keep the <strong>initial</strong> order of your data list, I surely found <strong>correct</strong> regexes, in the <strong>past</strong>, to achieve such a task, but, I didn’t want to bother looking for where ;-))</p>
<p dir="auto">So, thinking about a <strong>possible</strong> solution and having the results of the <strong>previous</strong> regex in front of me, everything became <strong>clear</strong> ! Don’t you see…?</p>
<ul>
<li>
<p dir="auto">First, copy in a <strong>new</strong> tab, your <strong>original</strong> list</p>
</li>
<li>
<p dir="auto">Then, add a line with, let’s say, some <strong>equal</strong> signs <strong><code>=</code></strong></p>
</li>
<li>
<p dir="auto">Finally add the <strong>previous</strong> results ( that is to say, <strong>all</strong> the <strong>isolated</strong> lines, after <strong>sort</strong> and regex <strong>replacement</strong> ) !</p>
</li>
</ul>
<p dir="auto">So, we have the following text :</p>
<pre><code class="language-diff">789
123
456
123
xyz
789
789
000
789
456
abc
123
123
456
hij
456
456
789
123
999
123
======
000
999
abc
hij
xyz
</code></pre>
<ul>
<li>
<p dir="auto">Now, use the regex <strong>S/R</strong>, below, which will keep the <strong>isolated</strong> lines, only, in their <strong>initial</strong> order ;-)</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^(.*\R)(?s)(?!.*^=+.*^\1)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">giving :</p>
<pre><code class="language-diff">xyz
000
abc
hij
999
</code></pre>
<p dir="auto">As you can see, these <strong>unique</strong> lines are listed, according to their <strong>initial</strong> location. Nice !</p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The regex  matches any line which <strong>cannot</strong> be found, further on, <strong>after</strong> the line <strong><code>======</code></strong></p>
</li>
<li>
<p dir="auto">Note that when the <strong>regex engine</strong> reaches the string <strong><code>======</code></strong>, this line, and the <strong>subsequent</strong> ones <strong>cannot</strong> be followed, further on, with a second line <strong><code>======</code></strong> =&gt; The <strong>negative look-ahead</strong> returns TRUE. Consequently, the <strong><code>======</code></strong> line and all the <strong>sorted isolated</strong> lines, obtained in the <strong>first</strong> part of this post, are, also, <strong>deleted</strong> ;-))</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35545</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35545</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 18 Oct 2018 23:23:24 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 18 Oct 2018 21:09:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/patrickdrd" aria-label="Profile: patrickdrd">@<bdi>patrickdrd</bdi></a><br />
I also found (searching the old posts) courtesy of @Scott_Sumner<br />
<a href="https://notepad-plus-plus.org/community/topic/14835/remove-duplicate-lines-from-unsorted-keeping-first/2" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/14835/remove-duplicate-lines-from-unsorted-keeping-first/2</a><br />
where the first regex may well be what you need. In that case the request was to keep one occurrence. If you have the Replace With field left empty I think it removes ALL copies. This will work when the data is sorted so the copies will sit together. You will only need to run it once, I’d suggest starting from the first line of the data to be sure it gets ALL the data you want to remove. Also make sure the last line has a CR/LF at the end, in effect the new last line will be empty.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35543</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35543</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 18 Oct 2018 21:09:16 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 18 Oct 2018 20:27:22 GMT]]></title><description><![CDATA[<p dir="auto">good idea, I’ll try with sorting, thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35542</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35542</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Thu, 18 Oct 2018 20:27:22 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 18 Oct 2018 20:13:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/patrickdrd" aria-label="Profile: patrickdrd">@<bdi>patrickdrd</bdi></a></p>
<p dir="auto">I think you need to read the link I provided. Whilst you have given some additional information some examples might be worthwhile (as stated in that post).</p>
<p dir="auto">So far we have ALL lines that are copies of each other to be deleted.</p>
<p dir="auto">I can think of a possible solution but 1 question currently is, can the lines be sorted? If so it would make it much easier using a regex (regular expression) to do so. When they are together they can be easily removed.</p>
<p dir="auto">As I said read the link I provided and if you are able to, give us some idea of the type of data you need fixing.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35541</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35541</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 18 Oct 2018 20:13:31 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 18 Oct 2018 20:08:29 GMT]]></title><description><![CDATA[<p dir="auto">yes, thanks, I want all copies deleted</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35540</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35540</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Thu, 18 Oct 2018 20:08:29 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 18 Oct 2018 20:07:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/patrickdrd" aria-label="Profile: patrickdrd">@<bdi>patrickdrd</bdi></a><br />
You will need to clarify a lot more if you expect decent/any answers.</p>
<p dir="auto">Read the FAQ, in particular<br />
<a href="https://notepad-plus-plus.org/community/topic/15739/faq-desk-request-for-help-without-sufficient-information-to-help-you" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/15739/faq-desk-request-for-help-without-sufficient-information-to-help-you</a></p>
<p dir="auto">I see the next post elaborated slightly but it’s still unclear.</p>
<p dir="auto">Say for example I have</p>
<pre><code>12345
12346
12347
2345
12345
234
12345
</code></pre>
<p dir="auto">Do you want ALL <code>12345</code> deleted or just the 2nd and 3rd copies.<br />
OR do you want 1st and 2nd copies deleted and the 3rd copy remains.</p>
<p dir="auto">You see it all depends on you providing enough information for us to give you help. You help us to help you.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35539</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35539</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 18 Oct 2018 20:07:29 GMT</pubDate></item><item><title><![CDATA[Reply to delete both duplicates regexp macro? on Thu, 18 Oct 2018 20:03:08 GMT]]></title><description><![CDATA[<p dir="auto">I want to delete both lines if found duplicates,</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35538</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35538</guid><dc:creator><![CDATA[patrickdrd]]></dc:creator><pubDate>Thu, 18 Oct 2018 20:03:08 GMT</pubDate></item></channel></rss>