<?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 delete text after the 2nd specific character in each row]]></title><description><![CDATA[<p dir="auto">how to delete text after the 2nd “|” in each row ( i just showed 3 rows for example )</p>
<p dir="auto">string1 | string2 | string3 | string5744<br />
string4001 | string2668 | string1234 | string496<br />
string201 | string202 | string203 | string489</p>
<p dir="auto">I would like to change it into this one :</p>
<p dir="auto">string1 | string2 |<br />
string4001 | string2668 |<br />
string201 | string202 |</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19570/how-to-delete-text-after-the-2nd-specific-character-in-each-row</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 01:39:27 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19570.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 Jun 2020 10:00:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 18:42:41 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1596220817708-schowek04.jpg" alt="Schowek04.jpg" class=" img-fluid img-markdown" /></p>
<pre><code>^((\w+ \| ){2})(.+)
</code></pre>
<p dir="auto">can be replaced individually</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56363</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56363</guid><dc:creator><![CDATA[Thomas 2020]]></dc:creator><pubDate>Fri, 31 Jul 2020 18:42:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 17:47:05 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1596217621893-schowek03.jpg" alt="Schowek03.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/56358</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56358</guid><dc:creator><![CDATA[Thomas 2020]]></dc:creator><pubDate>Fri, 31 Jul 2020 17:47:05 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 15:12:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19419">@Pan-Jan</a></p>
<p dir="auto">I’m sorry, but I think I’m out.<br />
If you think you’re gonna get anywhere with the way you communicate, good luck with that.<br />
I won’t waste any more time trying to figure out what you might mean.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56352</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56352</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 31 Jul 2020 15:12:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 14:52:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/18972">@Crimson-Virtuoso</a> said in <a href="/post/55077">How to delete text after the 2nd specific character in each row</a>:</p>
<blockquote>
<p dir="auto">string1 | string2 | string3 | string5744<br />
string4001 | string2668 | string1234 | string496<br />
string201 | string202 | string203 | string489</p>
</blockquote>
<p dir="auto">in this example there are 3 x |</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56350</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56350</guid><dc:creator><![CDATA[Thomas 2020]]></dc:creator><pubDate>Fri, 31 Jul 2020 14:52:19 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 12:59:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19419">@Pan-Jan</a></p>
<blockquote>
<p dir="auto">the pattern works from the cursor position.</p>
</blockquote>
<p dir="auto">that is correct but this means also that it can match the wrong parts.<br />
Assume the following ( <code>|</code> this should be the caret)</p>
<p dir="auto">string1 | stri<code>|</code>ng2 | string3 | string5744</p>
<p dir="auto">in that case it would handle string5744 as the match and NOT string3 | string5744</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56344</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56344</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 31 Jul 2020 12:59:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 12:44:26 GMT]]></title><description><![CDATA[<p dir="auto">If I wanted to swap lines one by one<br />
the pattern works from the cursor position.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56343</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56343</guid><dc:creator><![CDATA[Thomas 2020]]></dc:creator><pubDate>Fri, 31 Jul 2020 12:44:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 11:26:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19419">@Pan-Jan</a> said in <a href="/post/56340">How to delete text after the 2nd specific character in each row</a>:</p>
<blockquote>
<p dir="auto">I can’t think of any better.<br />
It would be better to replace “^” with “\A”.</p>
</blockquote>
<p dir="auto">Why do you think so? What is the advantage of using <code>\A</code> instead of <code>^</code> in this case?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56341</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56341</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 31 Jul 2020 11:26:08 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Fri, 31 Jul 2020 11:20:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a> said in <a href="/post/55090">How to delete text after the 2nd specific character in each row</a>:</p>
<blockquote>
<p dir="auto">You can use find to jump through the matches but you cannot use<br />
replace while doing this.</p>
</blockquote>
<p dir="auto">I can’t think of any better.<br />
It would be better to replace “^” with “\A”.</p>
<pre><code>^((\w+ \| ){2})(.+)
\1
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/56340</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56340</guid><dc:creator><![CDATA[Thomas 2020]]></dc:creator><pubDate>Fri, 31 Jul 2020 11:20:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Thu, 18 Jun 2020 20:56:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a></p>
<p dir="auto">Well, it wouldn’t be as simple as removing the indicated line, as that would break other functionality.<br />
Truly, though, I haven’t thought too much about it.<br />
While I can kinda read C++, and I can use the Visual Studio debugger to step through its code, it isn’t my strong suit.<br />
Hmm, maybe I don’t have a “strong suit”. (Is that a known expression?)<br />
I leave it to others, but I’m fairly confident in my analysis presented earlier about this; I spent a bit of time single-stepping through it and looking at it.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55132</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55132</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 18 Jun 2020 20:56:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Thu, 18 Jun 2020 20:46:20 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/18972">@crimson-virtuoso</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@ekopalypse</a> and <strong>All</strong>,</p>
<p dir="auto"><strong>Alan</strong>, very <strong>informative</strong> post, indeed ! So, If I <strong>correctly</strong> understand what you said, this means that :</p>
<ul>
<li>If the <strong>test</strong>, on present line <strong><code>1816</code></strong> of the <strong><code>FindReplaceDlg.cpp</code></strong> file, for a possible <strong>change</strong> of <strong>selection</strong> range, would have been <strong>absent</strong>, the <strong><code>\K</code></strong> <strong>regex</strong> feature would work, while doing a <strong>single</strong> replace operation, with the <strong><code>Replace</code></strong> button ?</li>
</ul>
<p dir="auto">I backup your post’s link for <strong>future</strong> reference, if any question regarding the <strong>weird</strong> behavior of the <strong><code>\K</code></strong> feature ;-))</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy0038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55129</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55129</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 18 Jun 2020 20:46:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Thu, 18 Jun 2020 13:15:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a></p>
<p dir="auto">thx for clarification, sounds reasonable.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55101</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55101</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 18 Jun 2020 13:15:17 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Thu, 18 Jun 2020 12:44:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a></p>
<blockquote>
<p dir="auto">you need to do replace all in order to make it work.<br />
To be honest, I don’t know why this happens. Bug/Feature !?</p>
</blockquote>
<p dir="auto">What if it isn’t really a bug and isn’t really a feature?<br />
But just something that happens as a side effect of usual processing?<br />
I guess it has to be labelled a “bug”.</p>
<p dir="auto">See <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/95c6d1ea1ec72a83d24e37a53d93d03f2f328864/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp#L1816" rel="nofollow ugc">HERE</a> for the line of code that I think prevents single replace (with <code>\K</code> involved) from working.</p>
<p dir="auto">When the <em>Replace</em> button is pressed, it really performs a “find next” first.  The match is shown to the user in the form of a selection.  A second press of <em>Replace</em> will then do the replacement, but first it verifies by doing another “find next” that the selected text is still a match.  The user could certainly have changed the selection to something else in the meantime, and N++ doesn’t just want to “blindly” replace the selected text.</p>
<p dir="auto">In the case of a <code>\K</code> usage, what is shown to the user (via selected text) as a match is only what matches after the (final) <code>\K</code> in the search expression.  Thus when N++ does its “verify check” that the selected text is indeed OK to be replaced, that check fails because it doesn’t match the <em>entire</em> search expression, but rather only the trailing part.  The line of code I flagged above will actually be comparing with the <em>next</em> real match of the entire expression, which fails and thus the replacement is not conducted.</p>
<p dir="auto"><em>Replace All</em> with <code>\K</code> works fine because it doesn’t have the “burden” of needing a mechanism to show what matched to the user.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55093</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55093</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 18 Jun 2020 12:44:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Thu, 18 Jun 2020 12:17:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/18972">@Crimson-Virtuoso</a></p>
<p dir="auto">one thing I keep forgetting, when using the <code>\K</code> notation then<br />
you need to do <strong>replace all</strong> in order to make it work.<br />
You can use <strong>find</strong> to jump through the matches but you cannot use<br />
<strong>replace</strong> while doing this. To be honest, I don’t know why this happens. Bug/Feature !?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55090</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55090</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 18 Jun 2020 12:17:00 GMT</pubDate></item><item><title><![CDATA[Reply to How to delete text after the 2nd specific character in each row on Thu, 18 Jun 2020 11:30:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/18972">@Crimson-Virtuoso</a> said in <a href="/post/55077">How to delete text after the 2nd specific character in each row</a>:</p>
<blockquote>
<p dir="auto">how to delete text after the 2nd “|” in each row ( i just showed 3 rows for example )<br />
string1 | string2 | string3 | string5744<br />
string4001 | string2668 | string1234 | string496<br />
string201 | string202 | string203 | string489<br />
I would like to change it into this one :<br />
string1 | string2 |<br />
string4001 | string2668 |<br />
string201 | string202 |</p>
</blockquote>
<p dir="auto">One solution might be to find: <code>^(.*?\|){2}\K.*</code><br />
and keep replace empty. Check regular expression.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55081</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55081</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 18 Jun 2020 11:30:17 GMT</pubDate></item></channel></rss>