<?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[Regex plese help - how to remove every 2nd and 3rd]]></title><description><![CDATA[<p dir="auto">Hi Friends</p>
<p dir="auto">please help me how to manage this<br />
I want to remove every send and third line in my text file without leaving a blank line.</p>
<p dir="auto">This is my file:</p>
<pre><code>Login: xxxx
Lng: Java:version- xxxx
Code: xxx
Login: xxxx
Lng: Java:version- xxxx
Code: xxx
Login: xxxx
Lng: Java:version- xxxx
Code: xxx
Login: xxxx
Lng: Java:version- xxxx
Code: xxx
</code></pre>
<p dir="auto">And i want to see</p>
<pre><code>Login: xxxx
Login: xxxx
Login: xxxx
Login: xxxx
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/topic/19123/regex-plese-help-how-to-remove-every-2nd-and-3rd</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 10:13:46 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19123.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 28 Mar 2020 18:30:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 21:50:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/martin-x" aria-label="Profile: Martin-X">@<bdi>Martin-X</bdi></a> said in <a href="/post/51838">Regex plese help - how to remove every 2nd and 3rd</a>:</p>
<blockquote>
<p dir="auto">So i want to use one regex command to delete second and third line and “Login:”</p>
</blockquote>
<p dir="auto">I will give you some guidance. If you look at <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a>  regex you will see the line that is written back is enclosed in brackets in the Find What line. The replace with line is <code>\1</code> which is how we write back that information within the bracket. By changing the contents of the bracket (essentially moving the bracket to the right) you will change what the regex keeps.<br />
Also note that you may have overlooked the space in the line you want to keep, now removing the front portion, so keep that in mind when editing his regex.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51840</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51840</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sat, 28 Mar 2020 21:50:50 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 20:38:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">trust me i try to learn something<br />
i spent today about 3 hours to find solution for various text files<br />
but this last one was to difficult for me</p>
<p dir="auto">Now I want to make it in one regex to save some space<br />
So i want to use one regex command to delete second and third line and “Login:”<br />
and leave only<br />
xxxx</p>
<p dir="auto">Can You help me one more time?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51838</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51838</guid><dc:creator><![CDATA[Martin X]]></dc:creator><pubDate>Sat, 28 Mar 2020 20:38:31 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 20:30:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/martin-x" aria-label="Profile: Martin-X">@<bdi>Martin-X</bdi></a></p>
<p dir="auto">Well, we ask people to “take away a bit of learning” from every piece of advice provided here.<br />
Given that, what might <em>you think</em> would be a modification to what was given earlier that would do what you now need?</p>
<p dir="auto">Unrelated: Using the previous resulting text as the new starting point, you could always search for <code>Login: </code> and replace with nothing. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51837</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51837</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 28 Mar 2020 20:30:45 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 20:24:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">Whank You very much :) works like a charm.</p>
<p dir="auto">But I want to ask for another example.<br />
How to change this regex</p>
<pre><code>^(Login:.+\R).+\R.+(?:\R|\z)
</code></pre>
<p dir="auto">if I want to get this effect:</p>
<p dir="auto">xxxx<br />
xxxx<br />
xxxx<br />
xxxx</p>
<p dir="auto">instead of:</p>
<p dir="auto">Login: xxxx<br />
Login: xxxx<br />
Login: xxxx<br />
Login: xxxx</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51836</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51836</guid><dc:creator><![CDATA[Martin X]]></dc:creator><pubDate>Sat, 28 Mar 2020 20:24:46 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 19:54:02 GMT]]></title><description><![CDATA[<p dir="auto">In this instance it isn’t that difficult to craft the solution that handles a file-ending of either type:</p>
<p dir="auto"><em><strong>Find what</strong></em> box: <code>^(Login:.+\R).+\R.+(?:\R|\z)</code><br />
<em><strong>Replace with</strong></em> box: <code>\1</code><br />
<em><strong>Match case</strong></em> checkbox: <strong>ticked</strong><br />
<em><strong>Search mode</strong></em> radiobutton: <em><strong>Regular expression</strong></em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/51830</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51830</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 28 Mar 2020 19:54:02 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 19:47:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/51822">Regex plese help - how to remove every 2nd and 3rd</a>:</p>
<blockquote>
<p dir="auto">I note <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a>  post stated search mode normal, however you had it as regular expression. Thats good as his post had that mistake but obviously you saw past that.</p>
</blockquote>
<p dir="auto">Arrrgh.  Apologies for the (obvious) mistake!</p>
<blockquote>
<p dir="auto">Unfortunately the last line has a end of file marker instead.</p>
</blockquote>
<p dir="auto">Yea, if we’re just talking about one file, just handle the last lines manually.<br />
If we’re talking thousands of files, though, you should state that initially and a solution that handles either kind of file ending can be developed.<br />
Or…use the editorconfig plugin and make sure all files are properly terminated with a line-ending (my preferred method).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51828</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51828</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 28 Mar 2020 19:47:59 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 19:17:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/martin-x" aria-label="Profile: Martin-X">@<bdi>Martin-X</bdi></a> said in <a href="/post/51821">Regex plese help - how to remove every 2nd and 3rd</a>:</p>
<blockquote>
<p dir="auto">Why it not remove them?</p>
</blockquote>
<p dir="auto">The reason is that the regex HAS to find 3 lines, all with end of line markers <code>\R</code>. Unfortunately the last line has a end of file marker instead. You will note that in your example it found 3 occurrences, not 4 as you should have expected.<br />
Another way to achieve what you want is to use the Mark function. Type <code>Login:</code> and make sure “bookmark line” is ticked. As the search text is constant this search can be done in normal mode even. Once the lines are marked (generally with a blue circle at start of line) you can then remove unmarked lines by going to Search\Bookmark\Remove unmarked lines. I did notice in a quick test that this also produces a side effect of leaving a blank line at the bottom of the file.</p>
<p dir="auto">Terry</p>
<p dir="auto">PS I note <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a>  post stated search mode normal, however you had it as regular expression. Thats good as his post had that mistake but obviously you saw past that.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51822</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51822</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sat, 28 Mar 2020 19:17:34 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 18:50:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">thank you<br />
your regular expression works but the last two lines remain<br />
Why it not remove them?</p>
<p dir="auto">before<br />
<img src="/assets/uploads/files/1585421431142-reg1.png" alt="reg1.png" class=" img-fluid img-markdown" /><br />
after<br />
<img src="/assets/uploads/files/1585421445920-reg2.png" alt="reg2.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/51821</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51821</guid><dc:creator><![CDATA[Martin X]]></dc:creator><pubDate>Sat, 28 Mar 2020 18:50:47 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 18:43:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> makes a good point, but if the OP <em>really</em> wants to use a regex replacement, I’d suggest:</p>
<p dir="auto"><em><strong>Find what</strong></em> box: <code>(?-s)^(Login:.+\R).+\R.+\R</code><br />
<em><strong>Replace with</strong></em> box: <code>\1</code><br />
<em><strong>Match case</strong></em> checkbox: <strong>ticked</strong><br />
<em><strong>Search mode</strong></em> radiobutton: <em><strong>Normal</strong></em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/51820</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51820</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 28 Mar 2020 18:43:13 GMT</pubDate></item><item><title><![CDATA[Reply to Regex plese help - how to remove every 2nd and 3rd on Sat, 28 Mar 2020 18:33:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/martin-x" aria-label="Profile: Martin-X">@<bdi>Martin-X</bdi></a> said in <a href="/post/51817">Regex plese help - how to remove every 2nd and 3rd</a>:</p>
<blockquote>
<p dir="auto">I want to remove every send and third line</p>
</blockquote>
<p dir="auto">As your file looks to only contain 3 types of lines, why not just sort the lines so all login lines are together. Then select all others and remove them.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51818</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51818</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sat, 28 Mar 2020 18:33:19 GMT</pubDate></item></channel></rss>