<?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[Replace-All can only replace up to 2046 characters long]]></title><description><![CDATA[<p dir="auto">Use case:<br />
I have a lot of lines of compilation commands I wanted to analyze. The commands were generated by Arduino IDE and are very long, over 26KB per line (yep). I wanted to remove the parts of the commands that have all the included library and only leave the options and the file name being compiled. I realized that even if I select all of the stuff to replace with an empty space, I only get first 2046 characters replaced.</p>
<p dir="auto">Cause: “Find what” text entry only allows 2046(or 2047) bytes.</p>
<p dir="auto">Recommendation: Make the text entry longer or a “Long find” check box to replace the 1-line text entry with a text box that can accommodate longer texts.</p>
<p dir="auto">I couldn’t post even sample lines for anyone to test because this post limits text to 16383 characters. So find yourself a long text and copy paste it several times to try.</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26404/replace-all-can-only-replace-up-to-2046-characters-long</link><generator>RSS for Node</generator><lastBuildDate>Sun, 07 Jun 2026 13:43:40 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26404.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 Nov 2024 15:25:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Replace-All can only replace up to 2046 characters long on Thu, 28 Nov 2024 15:57:02 GMT]]></title><description><![CDATA[<p dir="auto">As <a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said, anchors and regular expressions are the magic spells that I use to untangle lines - or even files, (like blobs of downloaded bank data) - that are hopelessly mangled together.</p>
<p dir="auto">Depending on how mangled the data is, it may take several tries - with a number of mistakes - before you get things the way you want them.</p>
<p dir="auto">It can be a process and don’t forget to make periodic backup saves in case you have to “undo” a search-and-replace.</p>
<p dir="auto">In my case I use Notepad++ to untangle downloaded bank data for tax purposes and, (depending on the size of the file and how mangled it is), it can take days to complete.</p>
<p dir="auto">Be patient.  Print out a regular expression cheat-sheet if you need one. (I did)  And don’t give up even if it seems like you’re going backwards.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98262</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98262</guid><dc:creator><![CDATA[Jim Harris]]></dc:creator><pubDate>Thu, 28 Nov 2024 15:57:02 GMT</pubDate></item><item><title><![CDATA[Reply to Replace-All can only replace up to 2046 characters long on Wed, 27 Nov 2024 01:50:12 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">An interesting technique, but I think it suffers from a limitation that may make it less useful than it at first appears.</p>
<p dir="auto">That limitation is maybe hard to put into words, but it involves that the replace point must be a line, and can’t be an arbitrary place in the data.  This is because of the use of the <em>Paste to (Replace) Bookmarked Lines</em> command; it always replaces a line and not in the middle of a line.</p>
<p dir="auto">Consider OP’s statement of “<em>over 26KB per line (yep)</em>”.  It is conceivable that someone with that data would want to replace inside that range, and without introducing any line “breaks”, in which case I don’t think your idea will satisfy.</p>
<p dir="auto">Regardless, I think <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> 's response is probably the right one for the OP’s problem.  Also, <a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> also offers some solid advice.  And who knows, applying a technique offered by <a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> might get data in good form to actually use your solution.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98215</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98215</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 27 Nov 2024 01:50:12 GMT</pubDate></item><item><title><![CDATA[Reply to Replace-All can only replace up to 2046 characters long on Wed, 27 Nov 2024 00:03:46 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/john-liudr" aria-label="Profile: john-liudr">@<bdi>john-liudr</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/john-liudr" aria-label="Profile: john-liudr">@<bdi>john-liudr</bdi></a>, regarding the problem of the text accepted in, both, the <strong><code>Find what:</code></strong> and <strong><code>Replace with</code></strong> zones which <em>CANNOT</em> exceed <strong><code>2,046</code></strong> characters, here is a <strong>general</strong> method to search a <strong>long</strong> amount of text and to replace it by an other <strong>long</strong> amount of text, too !</p>
<hr />
<p dir="auto">In order to <strong>practically</strong> test this method, I’ll use the <strong><code>License.txt</code></strong> file of my N++ <strong><code>v8.7.1</code></strong> version</p>
<ul>
<li>
<p dir="auto">First, I copy this file <strong>five</strong> times in an other file that I call <strong><code>Replace_Test.txt</code></strong></p>
</li>
<li>
<p dir="auto">Then, I select, in an <strong>other</strong> file, a <strong>large</strong> bunch of text which should be replaced, <strong>five</strong> times, in the <strong><code>Replace_Test.txt</code></strong> file, and I paste it, in the <strong>clipboard</strong>, with a <strong><code>Ctrl + C</code></strong> action</p>
</li>
</ul>
<p dir="auto">REMARK : do <strong>NOT</strong> select the <strong>last</strong> line-break ( <em>IMPORTANT</em> )</p>
<ul>
<li>
<p dir="auto">Now, regarding the <strong>long</strong> text to search for, which may occur <strong>one</strong> or <strong>several</strong> times in current file, and which must be replaced the <strong>same</strong> amount of times, I use the following regex S/R to define and <strong>delete</strong> the <strong>range</strong> of text :</p>
</li>
<li>
<p dir="auto">SEARCH <strong><code>(?s)^\QSTART of text\E.+?(?=^\QEND of text\E)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
<p dir="auto">Of course, in most of the cases, we may avoid the <strong><code>\Q</code></strong> and <strong><code>\E</code></strong> regex syntaxes. So, for our <strong>practical</strong> case, I’ll simply use the regex S/R :</p>
<p dir="auto">SEARCH  <strong><code>(?s-i)^TERMS AND CONDITIONS.+?(?=^END OF TERMS AND CONDITIONS)</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<ul>
<li>Check the <strong><code>Wrap around</code></strong> option and the <strong><code>Regular expression</code></strong> search mode</li>
</ul>
<p dir="auto">=&gt; As <strong>expected</strong>, after the <strong><code>Replace All</code></strong> action, it returns the message <strong><code>Replace All: 5 occurrences were replaced in entire file</code></strong></p>
<p dir="auto">Note that the <strong>END</strong> boundary, i.e. the string <strong><code>END OF TERMS AND CONDITIONS</code></strong>, is <strong>still</strong> present <strong>after</strong> this replacement</p>
<ul>
<li>
<p dir="auto">Now, open the <strong>Mark</strong> dialog ( <strong><code>Ctrl + M</code></strong> )</p>
</li>
<li>
<p dir="auto">Select the <strong>three</strong> options <strong><code>Bookmark line</code></strong>, <strong><code>Purge for each search</code></strong> and <strong><code>Wrap around</code></strong></p>
</li>
<li>
<p dir="auto">MARK <strong><code>(?-i)^END OF TERMS AND CONDITIONS</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; After a click on the <strong><code>Mark All</code></strong> button, we get the message <strong><code>Mark: 5 matches in entire file</code></strong></p>
<ul>
<li>Then, run the <strong><code>Search &gt; Bookmark &gt; Paste to (Replace) Bookmarked Lines</code></strong> menu option</li>
</ul>
<p dir="auto">=&gt; At each of the <strong>five</strong> bookmarked locations, of the <strong><code>Replace_Test.txt</code></strong>, the line <strong><code>END OF TERMS AND CONDITIONS</code></strong> has been replaced by the <strong>clipboard</strong> contents !</p>
<ul>
<li>Finally, save the <strong>new</strong> contents of the <strong><code>Replace_Test.txt</code></strong> file</li>
</ul>
<p dir="auto">Voila !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98214</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98214</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 27 Nov 2024 00:03:46 GMT</pubDate></item><item><title><![CDATA[Reply to Replace-All can only replace up to 2046 characters long on Tue, 26 Nov 2024 20:30:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/john-liudr" aria-label="Profile: John-Liudr">@<bdi>John-Liudr</bdi></a> I suspect many users of text editors such as Notepad++ regularly deal with long strings of data. I, and I suspect many of us, deal with this by breaking the problem down into smaller chunks.  For example, if I’m faced with 20K byte long command lines I’m likely to first break it down into multiple lines using<br />
<strong>Search: <code>(?&lt;= )(?=-[a-z0-9])</code><br />
Replace: <code>\r\n\t</code></strong></p>
<p dir="auto">That will replace/replace a space followed by a dash followed by a letter or digit into space, CR LF TAB, and then the dash and letter/digit.</p>
<p dir="auto">As the <code>-parameters</code> are now one per line I can do things such as deleting all of the <code>-I</code> parameters using<br />
<strong>Search: <code>(?-i)^\t-I.+\R</code><br />
Replace: <code>(nothing)</code></strong></p>
<p dir="auto">Multiple shorter lines is mentally easier for me to both see and to do search/replaces on.</p>
<p dir="auto">When I’m done I reassemble the thing into one long line again using<br />
<strong>Search: <code>(?&lt;= )\r\n\t(?=-[a-z0-9])</code><br />
Replace: <code>(nothing)</code></strong></p>
<p dir="auto">If I find myself needing to do a long search and/or replace expression then I tend to make them shorter by first inserting what I call anchors into the data. I pick a character such as <code>~</code> for my anchor and first make sure that character does not exist in the file. I can then insert anchors into the data and then use those anchors when doing search/replaces. The CR/LF/TABs I added and then removed in the above example are also anchors that have the side benefit in that the editor and its search/replace system had many line oriented features that I can take advantage of.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98208</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98208</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Tue, 26 Nov 2024 20:30:54 GMT</pubDate></item><item><title><![CDATA[Reply to Replace-All can only replace up to 2046 characters long on Tue, 26 Nov 2024 17:09:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/john-liudr" aria-label="Profile: John-Liudr">@<bdi>John-Liudr</bdi></a> ,</p>
<p dir="auto">you really shouldn’t need to keep the entire command in the <strong>Find what</strong>, especially if you use regular expressions.  The regular expression mode was designed to work for strings where a simple search/replace wasn’t sufficient, by using wildcards and pattern matching to keep them shorter and able to be more generic.</p>
<p dir="auto">I am assuming that Arduino compilation commands are using <code>-Ic:\long\path\to\library</code> (or something similar) to include libraries, and that you’ve got a bunch of those… the Find What = <code>-I[^ ]+</code> will match one of those when <strong>Search Mode</strong> is set to <code>Regular Expression</code>, and replacing with empty will delete it; doing a <strong>Replace All</strong> with that setup will remove all such instances.  No reason for &gt;2046 characters in the <strong>Find What</strong>.</p>
<p dir="auto">-—</p>
<h3>Useful References</h3>
<ul>
<li><a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">Notepad++ Online User Manual: Searching/Regex</a></li>
<li><a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regular-expressions-regex-documentation">FAQ: Where to find other regular expressions (regex) documentation</a></li>
<li><a href="/topic/15741">FAQ: Feature Request or Bug Report</a></li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/98199</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98199</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 26 Nov 2024 17:09:58 GMT</pubDate></item></channel></rss>