<?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 a specific char with the begining of the line]]></title><description><![CDATA[<p dir="auto">Hi friends, I hope you can help me please</p>
<p dir="auto">i have a text file formatted like this :</p>
<p dir="auto">Cell1-value1++value2++value3++value4…<br />
Cell2-valuea++valueb++valuec++valued…<br />
…<br />
Cell1213…<br />
Cell1214…</p>
<p dir="auto">What I want to do is to insert the Cell number between the double +</p>
<p dir="auto">Cell1-value1+Cell1+value2+Cell1+value3+Cell1+value4…<br />
Cell2-valuea+Cell2+valueb+Cell2+valuec+Cell2+valued…</p>
<p dir="auto">I tried with regex but didn’t find out how to solve this.</p>
<p dir="auto">Thank you for your help</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24795/replace-a-specific-char-with-the-begining-of-the-line</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 17:50:31 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24795.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 07 Aug 2023 17:20:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Replace a specific char with the begining of the line on Tue, 08 Aug 2023 08:24:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/88433">Replace a specific char with the begining of the line</a>:</p>
<p dir="auto">Peter Jones you saved my day !!<br />
Thank you very much &lt;3</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88446</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88446</guid><dc:creator><![CDATA[Axel Blitz]]></dc:creator><pubDate>Tue, 08 Aug 2023 08:24:09 GMT</pubDate></item><item><title><![CDATA[Reply to Replace a specific char with the begining of the line on Mon, 07 Aug 2023 17:52:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/axel-blitz" aria-label="Profile: Axel-Blitz">@<bdi>Axel-Blitz</bdi></a> said in <a href="/post/88429">Replace a specific char with the begining of the line</a>:</p>
<blockquote>
<p dir="auto">Cell1-value1++value2++value3++value4…<br />
Cell2-valuea++valueb++valuec++valued…</p>
</blockquote>
<ul>
<li>FIND = <code>^(\w+).*?\K\+\+</code></li>
<li>REPLACE = <code>+$1+</code></li>
<li>SEARCH MODE = Regular Expression</li>
<li>REPLACE ALL</li>
</ul>
<p dir="auto">Will replace the first <code>++</code> on each line with the cell value.  Clicking <strong>Replace All</strong> N times (where N is the maximum number of <code>++</code> on any of the thousands of lines in your file – or just stop clicking when the Replace dialog says “0 occurrences were replaced in entire file”) will propagate it to the very end.</p>
<p dir="auto">Quick explanation:</p>
<ul>
<li><code>^</code> = start match at beginning of line</li>
<li><code>(\w+)</code> = grab as many word characters (A-Z, 0-9, _) and store in group#1</li>
<li><code>.*?</code> = move forward on the line until whatever comes next in the regex is matched (this is a way to skip 0 or more characters, when you don’t know how many characters it will be)</li>
<li><code>\K</code> = this is a fancy thing that says “do all the matching before this symbol, but don’t include the text before this when i do a replacement later” – or, essentially, “keep (hence the <code>\K</code>) the text that comes before this”</li>
<li><code>\+\+</code> = match two literal <code>+</code> signs (+ is special to regex, so need a \ before it)</li>
<li><strong>REPLACE</strong>: <code>+$1+</code> =&gt; replace just the two + from the match with a single + then the contents of group 1 then a single + .</li>
</ul>
<p dir="auto">(Sorry that you might have to hit <strong>Replace All</strong> multiple times.  it might be possible to do with a very complicated single regular expression even if we cannot guarantee how many <code>++</code> there are beforehand, but it’s much easier to explain one where you just replace one <code>++</code> per line at a time.  With a file with 1000 or 10000 lines, if you only have 10 <code>++</code> per line, so it grows with the number of <code>++</code> not with the number of lines, so there is at least that.  And honestly, if you had more than 10 in a given row, the regex would be too complicated to type and use, so hitting 10 <strong>Replace All</strong> seems doable.  If you might have 100 <code>++</code> on a single line, then I suggest recording the replacement I showed as a macro, then use <strong>Macro &gt; Run a Macro Multiple Times</strong> to specify that you want to run the replacement 100 times without having to do 100 clicks.)</p>
<p dir="auto">-—</p>
<h3>Useful References</h3>
<ul>
<li><a href="https://community.notepad-plus-plus.org/topic/21965/please-read-before-posting">Please Read Before Posting</a></li>
<li><a href="https://community.notepad-plus-plus.org/topic/22022/template-for-search-replace-questions">Template for Search/Replace Questions</a></li>
<li><a href="https://community.notepad-plus-plus.org/topic/21925/faq-desk-formatting-forum-posts">Formatting Forum Posts</a></li>
<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>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/88433</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88433</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 07 Aug 2023 17:52:25 GMT</pubDate></item></channel></rss>