<?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[Advanced replace including right trim]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have read many posts on the subject but cannot find the desired solution.<br />
issue is as follows:<br />
I have a CSV-file that i want to use as an external table in Oracle.<br />
It is formatted like this:<br />
&lt;values Field01&gt;;&lt;values Field02&gt;;&lt;values Field03&gt;; &lt;values Field04&gt;<br />
In fact there are more fields, but my issue is with the last field.<br />
Field 1 to 3 are defined as Char (255) fields in the oracle external table.<br />
The last field, Field04, is a memo field that should be max. 4000 characters in the interface CSV-file, but probably due to codeset the last field is way over 4000 Characters. (according to Excel)</p>
<p dir="auto">I need to find the pattern like "n-characters field01"Semicolon"n-characters field02"Semicolon"n-characters field03"Semicolon<br />
and trim the rest after the last semicolon to 4000 characters to let it fit in the Oracle table.<br />
so field 1 to 3 with variable length + 4000 additional characters for field04.</p>
<p dir="auto">Hope that there’s a Notepad++Wizard here that can solve this.</p>
<p dir="auto">Thanks in advance!<br />
Mike</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26759/advanced-replace-including-right-trim</link><generator>RSS for Node</generator><lastBuildDate>Mon, 15 Jun 2026 01:39:14 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26759.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Apr 2025 15:24:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Advanced replace including right trim on Wed, 09 Apr 2025 13:39:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mike-albers" aria-label="Profile: Mike-Albers">@<bdi>Mike-Albers</bdi></a> deleted the first post, and started a new conversation Topic <a href="/topic/26765">here</a>.</p>
<p dir="auto">In the future, please do not delete posts that have replies.  And if you want to clarify, provide more details, etc, you can just do that in a reply, so that the conversation keeps the original context.</p>
<p dir="auto">To preserve the history of this discussion, the first post has been un-deleted.  But since the conversation has moved forward in the <a href="/topic/26765">new Topic</a>, this old version has been locked.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/100881</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/100881</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 09 Apr 2025 13:39:49 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced replace including right trim on Tue, 08 Apr 2025 18:27:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mike-albers" aria-label="Profile: Mike-Albers">@<bdi>Mike-Albers</bdi></a><br />
If you need to match <code>\n</code> but not <code>\r\n</code>, try replacing <code>((?:[^\r\n;]|(?&lt;!\r)\n){4000})(?:[^\r\n;]|(?&lt;!\r)\n)+(?=\r\n)</code> with <code>$1</code>.</p>
<p dir="auto">I’m writing my response on my phone, so I prefer brevity. That said, my new regex uses lookahead and lookbehind. Google those terms for some guidance.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/100846</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/100846</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 08 Apr 2025 18:27:48 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced replace including right trim on Tue, 08 Apr 2025 18:17:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mike-albers" aria-label="Profile: Mike-Albers">@<bdi>Mike-Albers</bdi></a> said in <a href="/post/100839">Advanced replace including right trim</a>:</p>
<blockquote>
<p dir="auto">I tested the solution but it is not working. Zero replacements.</p>
<p dir="auto">But i forgot to mention that in the last field before \r\n there can be several \n characters in the tekst string.<br />
In that memo field people entered some tekst or uploaded e-mails etc… So the format is unpredictable. The record should be seen as one line that ends with carriage return linefeed.</p>
</blockquote>
<p dir="auto">I would suggest looking at <a class="plugin-mentions-user plugin-mentions-a" href="/user/bas-de-reuver" aria-label="Profile: Bas-de-Reuver">@<bdi>Bas-de-Reuver</bdi></a> ’s <a href="https://github.com/BdR76/CSVLint/" rel="nofollow ugc">CSVLint</a> plugin for working with CSV files. I don’t know enough about it to say whether it can solve your problem, but I can say that working in CSV files with regular expressions is error-prone.</p>
<p dir="auto">My own Columns++ plugin can <a href="https://coises.github.io/ColumnsPlusPlus/help.htm#conversion" rel="nofollow ugc">convert</a> CSV to tab-separated values and back again; tab-separated values are less problematic to search and manipulate than delimiter-separated values. However, I suggest CSVLint first, if it can do what you need.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/100845</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/100845</guid><dc:creator><![CDATA[Coises]]></dc:creator><pubDate>Tue, 08 Apr 2025 18:17:56 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced replace including right trim on Tue, 08 Apr 2025 18:10:31 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/mike-albers" aria-label="Profile: mike-albers">@<bdi>mike-albers</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/mark-olson" aria-label="Profile: mark-olson">@<bdi>mark-olson</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">First, <a class="plugin-mentions-user plugin-mentions-a" href="/user/mike-albers" aria-label="Profile: mike-albers">@<bdi>mike-albers</bdi></a>, I advice you to <strong>backup</strong> your file <em>BEFORE</em> trying my S/R :</p>
<p dir="auto">If we assume that your <strong>last</strong> field does <strong>not</strong> contain any <strong><code>;</code></strong> nor <strong><code>\r</code></strong>, nor <strong><code>\n</code></strong> within the <strong>first</strong> <strong><code>4,000</code></strong> characters,</p>
<p dir="auto">I would <strong>simplify</strong> the problem, using this regex S/R :</p>
<ul>
<li>
<p dir="auto">FIND <strong><code>([^;\r\n]{4000})(?s).+$</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>$1</code></strong></p>
</li>
</ul>
<p dir="auto">So, for <strong>each</strong> record :</p>
<ul>
<li>
<p dir="auto"><strong>Any</strong> character placed in the <strong>last</strong> field, under <strong><code>4,001</code></strong>, will be <strong>kept</strong></p>
</li>
<li>
<p dir="auto"><strong>Any</strong> character placed in the <strong>last</strong> field, over <strong><code>4,000</code></strong>, will be <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/100844</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/100844</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 08 Apr 2025 18:10:31 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced replace including right trim on Tue, 08 Apr 2025 18:05:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mark-olson" aria-label="Profile: Mark-Olson">@<bdi>Mark-Olson</bdi></a></p>
<p dir="auto">Hi Mark,</p>
<p dir="auto">I tested the solution but it is not working. Zero replacements.</p>
<p dir="auto">But i forgot to mention that in the last field before \r\n there can be several \n characters in the tekst string.<br />
In that memo field people entered some tekst or uploaded e-mails etc… So the format is unpredictable. The record should be seen as one line that ends with carriage return linefeed.<br />
That omission on my part might be why it is not working…</p>
<p dir="auto">I also tried to put all the records on their own line by doing the following search/replace first;<br />
\n := \t\n  wich resulted in \t\n in the memo field ending with \r\t\n.<br />
then<br />
\r\t\n := \r\n<br />
then<br />
\t\n  := \t<br />
After which all the fields were in their own single line.</p>
<p dir="auto">Then applied your solution again, but also zero replacements.</p>
<p dir="auto">Since i cannot fully comprehend what you gave me, i don’t get it.</p>
<p dir="auto">My workaround could be to truncate every line at the 4000th character, but i really try to keep all (up to 4000) characters in that last memo field.</p>
<p dir="auto">Hope it can be solved.<br />
Thanks,<br />
Mike</p>
]]></description><link>https://community.notepad-plus-plus.org/post/100839</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/100839</guid><dc:creator><![CDATA[Mike Albers]]></dc:creator><pubDate>Tue, 08 Apr 2025 18:05:05 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced replace including right trim on Tue, 08 Apr 2025 16:51:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mark-olson" aria-label="Profile: Mark-Olson">@<bdi>Mark-Olson</bdi></a></p>
<p dir="auto">Thank you i will try it out but i am trying to understand the solution too. Can you please explain it a bit?<br />
As far as i understand you do a search with negative on carriage return linefeed and then a semicolon. But how will that find the last semicolon? And how will it find the following string with a maximum of 4000 characters even when it can be far less or bigger then 4000.  Or does a negative search mean that it goes backwards from the end.<br />
Want to learn from your solution. Not copy/paste it like a monkey. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/100838</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/100838</guid><dc:creator><![CDATA[Mike Albers]]></dc:creator><pubDate>Tue, 08 Apr 2025 16:51:25 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced replace including right trim on Tue, 08 Apr 2025 16:38:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mike-albers" aria-label="Profile: Mike-Albers">@<bdi>Mike-Albers</bdi></a><br />
Pretty sure using the find/replace form to replace <code>([^\r\n;]{4000})[^\r\n;]+$</code> with <code>$1</code> would solve your issue.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/100837</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/100837</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 08 Apr 2025 16:38:48 GMT</pubDate></item></channel></rss>