<?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[New line every n characters]]></title><description><![CDATA[<p dir="auto">I have a very basic necessity and I don’t know how to address it with Notepad++<br />
I have a text file with records of 500 characters each, fixed lenght.<br />
I can import this file into my accounting software, but before doing this I would like to examine the content.<br />
Unfortunately the text file is sequential, i.e. all in the same line.<br />
How can I display the content of this file in Notepad++ in lines of 500 characters each? How can I make Notepad++ create a new line every 500 charcaters?<br />
Thank you for your help.<br />
Giannicola</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20916/new-line-every-n-characters</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 03:41:49 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20916.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Mar 2021 16:58:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to New line every n characters on Tue, 23 Mar 2021 10:57:38 GMT]]></title><description><![CDATA[<p dir="auto">I am stunned by the quantity and quality of help available in this community in a very short time! Thank you very much to everyone :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64254</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64254</guid><dc:creator><![CDATA[Giannicola Bonora]]></dc:creator><pubDate>Tue, 23 Mar 2021 10:57:38 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Sat, 20 Mar 2021 02:26:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> said in <a href="/post/64155">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">usermanual issue #178 submitted.</p>
</blockquote>
<p dir="auto">I’ve taken this to a new discussion located <a href="https://community.notepad-plus-plus.org/topic/20918/use-of-wrap-around-changing-start-position-of-search-if-replace-all-button-pressed">here</a>.<br />
As far as the OP’s problem, this has been solved. I did not wish to further muddy these waters and have instead continued with a new post.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64159</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64159</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sat, 20 Mar 2021 02:26:06 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Sat, 20 Mar 2021 00:08:40 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> said in <a href="/post/64152">New line every n characters</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> said in <a href="/post/64149">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">So Replace All with Wrap Around ticked starts at the first position in the file.<br />
Replace All button with Wrap Around NOT ticked starts at the current position.</p>
</blockquote>
</blockquote>
<p dir="auto"><s>I disagree.  AFAIK, if my cursor is on line 3 of a 5-line file, and there is a sequence that will match on all 5 lines, and I hit replace all with wrapping enabled, the first replacement will be on line 3, the second on line 4, the third on line 5, the fourth on line 1, and the fifth on line 2.  I cannot think of a regex offhand that would cause that to be different than starting a replace-all at the begining of a file… but there might be one.</s></p>
<p dir="auto">… experiment …</p>
<p dir="auto">Nope, I was wrong.</p>
<p dir="auto">Data:</p>
<pre><code>one two three four five
fourteen something fifteen
</code></pre>
<p dir="auto">regex = FIND:<code>(?i-s)\b((?&lt;!☺ )f\w+)</code> =&gt; REPLACE:<code>${1}☺</code></p>
<p dir="auto">If my original assertion, and what is implied in the manual, were true, then starting with the cursor before <code>four</code> vs. before <code>five</code> and hitting <strong>Replace All</strong> would come up with different answers.  Between the <code>four</code> and <code>five</code>, it would add a smiley to <code>five</code> if it really started wherever the cursor was, but would only add a smiley after <code>four</code> if it really started from the beginning.</p>
<p dir="auto">With wrap-around enabled, it only puts the smiley after the <code>four</code>, not the <code>five</code>; without wrap-around, it puts it after the <code>five</code> if the cursor is between.</p>
<blockquote>
<blockquote>
<p dir="auto">Is this something that needs to be amended?</p>
</blockquote>
<p dir="auto">Yes, if that’s what the manual says, then I think it could be better.</p>
<p dir="auto">What does <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> think, as our resident manual guru?</p>
</blockquote>
<p dir="auto">What I thought is different than what I could prove.  I thought wrong.<br />
<a href="https://github.com/notepad-plus-plus/npp-usermanual/issues/178" rel="nofollow ugc">usermanual issue #178</a> submitted.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64155</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64155</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 20 Mar 2021 00:08:40 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 23:10:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> said in <a href="/post/64149">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">So Replace All with Wrap Around ticked starts at the first position in the file.<br />
Replace All button with Wrap Around NOT ticked starts at the current position.<br />
From your example I see it works.</p>
</blockquote>
<p dir="auto">My earlier postings were not so great :-(<br />
But I see that you got the point.</p>
<p dir="auto">I’m not sure <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> 's posting adds anything, except as another example of proof of how it works?</p>
<blockquote>
<p dir="auto">The manual does NOT appear to outline this VERY important change. At least not where Wrap Around and Replace All are described!<br />
Is this something that needs to be amended?</p>
</blockquote>
<p dir="auto">Yes, if that’s what the manual says, then I think it could be better.<br />
What does <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> think, as our resident manual guru?</p>
<p dir="auto">BTW, a posting somewhere here long ago (I think) said to think about <em>Wrap around</em> ticked as meaning “Entire document” in this (<em>Replace All</em>) circumstance, and I’ve always remembered that, as it seems to be appropriate.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64152</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64152</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 19 Mar 2021 23:10:32 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 22:22:53 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@terry-r</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a>, and <strong>All</strong>,</p>
<p dir="auto">Let’s consider this simple text, below, in a <strong>new</strong> <em>Windows</em> tab</p>
<pre><code class="language-diff">123
456
789
</code></pre>
<p dir="auto">with the <strong>last</strong> line <strong>without</strong> <em>CRLF</em>. So, the <strong>exact</strong> contents are the <strong><code>13</code></strong> bytes <strong><code>1 2 3 CR LF 4 5 6 CR LF 7 8 9</code></strong></p>
<hr />
<p dir="auto"><em>FIRST</em> test :</p>
<ul>
<li>
<p dir="auto">Move the caret right <strong>after</strong> digit <strong><code>5</code></strong></p>
</li>
<li>
<p dir="auto">Run the regex S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s).{3}</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>@</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Untick</strong> the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">we get the text :</p>
<pre><code class="language-diff">123
45@@
</code></pre>
<p dir="auto"><strong>without</strong> <em>CRLF</em> after the last <strong><code>@</code></strong> char. Remember that the <strong><code>CR</code></strong> and <strong><code>LF</code></strong> characters count for <em>ONE</em> char because of the <strong><code>(?s)</code></strong> syntax !</p>
<ul>
<li>
<p dir="auto">Then, move the caret at the <strong>very beginning</strong> of file, right <strong>before</strong> the digit <strong><code>1</code></strong></p>
</li>
<li>
<p dir="auto">Run the regex S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s).{3}</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>@</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>Wrap around</code></strong> option is still <strong>unticked</strong></p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">The text is now changed as :</p>
<pre><code class="language-diff">@@@
</code></pre>
<p dir="auto"><strong>without</strong> <em>CRLF</em> after the last <strong><code>@</code></strong> char</p>
<p dir="auto">So, it’s the <strong>final</strong> result if we suppose that the <strong>regex engine</strong> goes from the digit <strong><code>6</code></strong> to the digit <strong><code>9</code></strong>, then from digit <strong><code>1</code></strong> to digit <strong><code>5</code></strong></p>
<hr />
<p dir="auto"><em>SECOND</em> test :</p>
<ul>
<li>
<p dir="auto">Move, again, the caret right <strong>after</strong> digit <strong><code>5</code></strong></p>
</li>
<li>
<p dir="auto">Run the <strong>same</strong> regex S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s).{3}</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>@</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Tick</strong> the <strong><code>Wrap around</code></strong> option ( <em>IMPORTANT</em> )</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">we get the text :</p>
<pre><code class="language-diff">@@@@9
</code></pre>
<p dir="auto"><strong>without</strong> <em>CRLF</em> after the <strong><code>9</code></strong> digit</p>
<p dir="auto">And this result <strong>proves</strong> that, although the caret was <strong>initially</strong> between digits <strong><code>5</code></strong> and <strong><code>6</code></strong>, due to the <strong><code>Wrap around</code></strong> option <strong>ticked</strong>, the caret is <strong>internally</strong> moved at the <strong>very beginning</strong> of file and, then, the <strong>regex engine</strong> goes from digit <strong><code>1</code></strong> to digit <strong><code>9</code></strong> to process contents</p>
<p dir="auto">As the <strong>total</strong> number of bytes is <strong><code>13</code></strong>, this means that the <strong>search</strong> regex had sliced the text in <strong><code>4</code></strong> <strong>ranges</strong> of <strong><code>3</code></strong> chars, leaving the <strong><code>9</code></strong> digit alone, at the <strong>end</strong> ! Just <strong>logical</strong> ;-))</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64150</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64150</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 19 Mar 2021 22:22:53 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 21:30:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> said in <a href="/post/64146">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">So then the wrap around being ticked is actually redundant with a Replace All button press.</p>
</blockquote>
<p dir="auto">Sorry, I had read it differently the first time.</p>
<p dir="auto">So Replace All with Wrap Around ticked starts at the first position in the file.<br />
Replace All button with Wrap Around NOT ticked starts at the current position.</p>
<p dir="auto">From your example I see it works. The manual does NOT appear to outline this VERY important change. At least not where Wrap Around and Replace All are described!</p>
<p dir="auto">Is this something that needs to be amended?</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64149</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64149</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 19 Mar 2021 21:30:46 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 21:16:30 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> said in <a href="/post/64144">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">Perhaps you don’t know that a Replace All search with Wrap around ticked does one transit through the file, starting at the very top, no matter where the caret starts out at?</p>
</blockquote>
<p dir="auto">I just checked the manual and there it says:<br />
<em>Replace All: Replaces all matches from the active location onward (following the Backward direction and Wrap around settings as appropriate).</em></p>
<p dir="auto">That then seems to be wrong unless my interpretation is wrong of what active location means.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64147</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64147</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 19 Mar 2021 21:16:30 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 21:06:49 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> said in <a href="/post/64144">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">Perhaps you don’t know that a Replace All search with Wrap around ticked does one transit through the file, starting at the very top, no matter where the caret starts out at?</p>
</blockquote>
<p dir="auto">Oh, no I hadn’t realised that important fact. I suppose in tests I have always identified that as a potential issue when using  the Replace button. Thank you for pointing out that important fact.</p>
<p dir="auto">So then the wrap around being ticked is actually redundant with a Replace All button press.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64146</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64146</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 19 Mar 2021 21:06:49 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 20:05:41 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> said in <a href="/post/64144">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">Prove it thusly:</p>
<p dir="auto">Find data for both cases: abcdefghijklmno<br />
Replace data for both cases: @<br />
Caret starting location for both cases: between the b and the c.</p>
</blockquote>
<p dir="auto">Reading my own posting I am stunned to see that I left off a very important part of the instructions, applicable to both Case 1 and 2:</p>
<ul>
<li>Put <code>(?-s).{10}</code> in the <em>Find what</em> box</li>
</ul>
<p dir="auto">And of course this doesn’t make any sense unless we’re in <em>Regular expression</em> for the <em>Search mode</em>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64145</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64145</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 19 Mar 2021 20:05:41 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 19:40:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a></p>
<p dir="auto">Well, I use <code>(?-s)</code> as a “safety measure”.  If I don’t intend line-ending characters to be matched by the <code>.</code>, I preamble with <code>(?-s)</code>.  For me, it’s a good habit to always specify <code>(?s)</code> or <code>(?-s)</code> when using <code>.</code>.  And, I believe it is a good habit for forum postings as well, so that the <code>. matches newline</code> checkbox state doesn’t have to be provided as a separate item.</p>
<p dir="auto">But sure, since there are no line-endings in the OP’s data…</p>
<blockquote>
<p dir="auto">Untick wrap around button as important the regex starts in very first position.</p>
</blockquote>
<p dir="auto">I don’t understand what is meant here.  Well, I understand how to untick, but I don’t know what the rest means or how it is relevant.</p>
<blockquote>
<p dir="auto">Cursor MUST be in first position of file BEFORE regex run.</p>
</blockquote>
<p dir="auto">Hmmm, having <em>Wrap around</em> ticked negates the need for this, and is simpler than telling a user to move the caret.</p>
<p dir="auto">Perhaps you don’t know that a <em>Replace All</em> search with <em>Wrap around</em> ticked does one transit through the file, starting at the very top, no matter where the caret starts out at?</p>
<p dir="auto">Maybe you do know, but I’ll keep going for those that don’t…</p>
<p dir="auto">Prove it thusly:</p>
<ul>
<li>Find data for both cases: <code>abcdefghijklmno</code></li>
<li>Replace data for both cases: <code>@</code></li>
<li>Caret starting location for both cases: between the <code>b</code> and the <code>c</code>.</li>
</ul>
<h4>Case 1:</h4>
<ul>
<li>Tick <em>Wrap around</em></li>
<li>Press <em>Replace all</em></li>
</ul>
<p dir="auto">Result: <code>@klmno</code></p>
<h4>Case 2:</h4>
<ul>
<li>Untick <em>Wrap around</em></li>
<li>Press <em>Replace all</em></li>
</ul>
<p dir="auto">Result: <code>ab@mno</code></p>
<p dir="auto">The key point here is that for Case 1 the search matches at start of file, NOT from the caret.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64144</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64144</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 19 Mar 2021 19:40:52 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 19:06:19 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> said in <a href="/post/64135">New line every n characters</a>:</p>
<blockquote>
<p dir="auto">find: (?-s).{500}<br />
repl: ${0}\r\n<br />
Tick the Wrap around box, and press Replace All button</p>
</blockquote>
<p dir="auto">I would make some changes:</p>
<ol>
<li><code>(?-s)</code> is not required as no newline characters in file</li>
<li>Untick wrap around button as important the regex starts in very first position.</li>
<li>Cursor MUST be in first position of file BEFORE regex run.</li>
</ol>
<p dir="auto">All because OP stated it is all serial information, so ALL on one line.</p>
<p dir="auto">Likely without these changes it will work out OK but if OP had moved through file first before starting the regex the cut points will be in the wrong positions.</p>
<p dir="auto">My 2c worth<br />
Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64143</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64143</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 19 Mar 2021 19:06:19 GMT</pubDate></item><item><title><![CDATA[Reply to New line every n characters on Fri, 19 Mar 2021 17:06:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21531">@Giannicola-Bonora</a></p>
<p dir="auto">Well, it might be hard to just display it, but if you want to look at it that way I would suggest making a copy of it and then working with the copy in the following manner:</p>
<p dir="auto">Set <em>Search Mode</em> in the <em>Replace</em> window to <em>Regular expression</em></p>
<p dir="auto">Then,</p>
<p dir="auto">find: <code>(?-s).{500}</code><br />
repl: <code>${0}\r\n</code></p>
<p dir="auto">Tick the <em>Wrap around</em> box, and press <em>Replace All</em> button.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/64135</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/64135</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 19 Mar 2021 17:06:28 GMT</pubDate></item></channel></rss>