<?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 replace text at a special place in special rows?]]></title><description><![CDATA[<p dir="auto">Hello, I want replace text (for example 5000x5000 with 4500x4500) only in the rows with the text projectID:1234</p>
<p dir="auto">I got the answer how to do this at<br />
<a href="https://community.notepad-plus-plus.org/topic/19742/how-to-replace-only-in-rows-with-a-special-text:">https://community.notepad-plus-plus.org/topic/19742/how-to-replace-only-in-rows-with-a-special-text:</a> 5000x5000(?=.*?projectID:1234)</p>
<p dir="auto">But now I want to have a further condition set:</p>
<p dir="auto">I want to replace the text only for a special platform.</p>
<p dir="auto">My file is like this (pf1=platform1, pf2=platform2…):</p>
<p dir="auto">{name:11.png,filename:c:\img\11\11.png,projectID:1234},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:11.png,spfilename:11.png},pf3:{…}<br />
{name:11.png,filename:c:\img\11\11.png,projectID:1234},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:33.png,spfilename:33.png},pf3:{…}<br />
{name:11.png,filename:c:\img\11\11.png,projectID:3456},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:11.png,spfilename:11.png},pf3:{…}<br />
{name:11.png,filename:c:\img\11\11.png,projectID:4567},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:11.png,spfilename:11.png},pf3:{…}<br />
…</p>
<p dir="auto">Now for example I want to replace 11 with 22 only where the projectID is 1234 AND only for platform2 (pf2 in file)<br />
After this I have this file:</p>
<p dir="auto">{name:11.png,filename:c:\img\11\11.png,projectID:1234},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:22.png,spfilename:22.png},pf3:{…}<br />
{name:11.png,filename:c:\img\11\11.png,projectID:1234},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:33.png,spfilename:33.png},pf3:{…}<br />
{name:11.png,filename:c:\img\11\11.png,projectID:3456},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:11.png,spfilename:11.png},pf3:{…}<br />
{name:11.png,filename:c:\img\11\11.png,projectID:4567},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:11.png,spfilename:11.png},pf3:{…}<br />
…</p>
<p dir="auto">The first part I can do with this regular expression:</p>
<p dir="auto">find: 11(?=.*?projectID:1234)<br />
replace with: 22<br />
(regular expression checked)</p>
<p dir="auto">But this condition alone would change all incidences of 11 with 22 in a row where the text projectID:1234 is in the row.<br />
But I want to only have the 11 changed to 22 in the parenthesis of pf2:{spname:11.png,spfilename:11.png}</p>
<p dir="auto">So how can this been done - only change rows with a special projectID and as second condition only in the parenthesis of pf2?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19771/how-to-replace-text-at-a-special-place-in-special-rows</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 15:28:28 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19771.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 28 Jul 2020 16:37:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Thu, 06 Aug 2020 11:56:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/16367">@Makwana-Prahlad</a></p>
<p dir="auto">How is that relevant?<br />
You provided a solution for 2 things that were not even asked for.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56524</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56524</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 06 Aug 2020 11:56:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Thu, 06 Aug 2020 05:07:49 GMT]]></title><description><![CDATA[<p dir="auto">Hello,<a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19281">@ErwinSchmidt17</a></p>
<p dir="auto">Follow this step,To How to replace text at a special place in special rows?</p>
<p dir="auto"><strong>Step 1:</strong> Press Ctrl+H to bring up the Find/Replace Dialog.<br />
<strong>Step 2:</strong> Choose the Regular expression option near the bottom of the dialog.</p>
<p dir="auto">To add a word, such as test, at the beginning of each line:<br />
<strong>Step 1:</strong> Type ^ in the Find what textbox<br />
<strong>Step 2:</strong> Type test in the Replace with textbox<br />
<strong>Step 3:</strong> Place cursor in the first line of the file to ensure all lines are affected<br />
<strong>Step 4:</strong> Click Replace All button</p>
<p dir="auto">To add a word, such as test, at the end of each line:<br />
<strong>Step 1:</strong> Type $ in the Find what textbox<br />
<strong>Step 2:</strong> Type test in the Replace with textbox<br />
<strong>Step 3:</strong> Place cursor in the first line of the file to ensure all lines are affected<br />
<strong>Step 4:</strong> Click Replace All button</p>
<p dir="auto">I hope this information will be useful.<br />
Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56520</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56520</guid><dc:creator><![CDATA[Makwana Prahlad]]></dc:creator><pubDate>Thu, 06 Aug 2020 05:07:49 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Wed, 05 Aug 2020 20:56:46 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">:-D</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56512</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56512</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 05 Aug 2020 20:56:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Wed, 05 Aug 2020 20:52:11 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">sounds like a 32bit integer limitation.</p>
</blockquote>
<p dir="auto">Or an implementation detail. ;-)<br />
BTW, trying this in RegexBuddy, it reports “group 2147483647” but if you go one higher it reports “group -2147483648”.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56511</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56511</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 05 Aug 2020 20:52:11 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Wed, 05 Aug 2020 20:00:34 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> - sounds like a 32bit integer limitation.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56507</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56507</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 05 Aug 2020 20:00:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Mon, 02 Nov 2020 16:54:22 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>All</strong>,</p>
<p dir="auto">Out of <strong>curiosity</strong>, do you know how I could <strong>determine</strong> that the <strong>maximum</strong> number of group is <strong><code>2,147,483,647</code></strong> ?</p>
<p dir="auto">Well, I began the <strong>test</strong> using this simple regex S/R :</p>
<p dir="auto">SEARCH <strong><code>(?-s).</code></strong></p>
<p dir="auto">REPLACE <strong><code>--${300}--</code></strong></p>
<p dir="auto">When replacing a <strong>single</strong> character, it returns the string <strong><code>----</code></strong>. So, the S/R seemed <strong>valid</strong> and, as the group <strong><code>300</code></strong> did <strong>not</strong> exist, it just wrote the <strong>empty</strong> string as replacement of this group.</p>
<p dir="auto">Then, I, successively, changed the <strong>replacement</strong> zone with :</p>
<ul>
<li>
<p dir="auto"><strong><code>--${3000}--</code></strong>    =&gt;    <strong><code>----</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>--${30000}--</code></strong>    =&gt;    <strong><code>----</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>--${3000000000}--</code></strong>    =&gt;    <strong><code>--$3000000000}--</code></strong></p>
</li>
</ul>
<p dir="auto">As I suspected that the <strong>limit</strong> should have a relation to <strong>powers</strong> of <strong><code>2</code></strong>, I searched for the <strong>largest</strong> power of <strong><code>2</code></strong>, <strong>below</strong> <strong><code>3,000,000</code></strong>, which is <strong><code>2^31</code></strong> = <strong><code>2,147,483,647</code></strong> !</p>
<p dir="auto">Indeed :</p>
<p dir="auto">SEARCH <strong><code>(?-s).</code></strong></p>
<p dir="auto">REPLACE <strong><code>--${2147483647}--</code></strong></p>
<p dir="auto">=&gt; The <strong><code>----</code></strong> <strong>output</strong></p>
<p dir="auto">and :</p>
<p dir="auto">SEARCH <strong><code>(?-s).</code></strong></p>
<p dir="auto">REPLACE <strong><code>--${2147483648}--</code></strong></p>
<p dir="auto">=&gt; The <strong><code>--${2147483648}--</code></strong> <strong>output</strong></p>
<p dir="auto">Of course, I do understand that this <strong>limit</strong> is quite <strong>theoretical</strong> ! Just imagine a regex containing <strong><code>2,147,483,647</code></strong> <strong>different</strong> groups… Brrrrr</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56459</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56459</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 02 Nov 2020 16:54:22 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 04 Aug 2020 23:08:30 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19281">@ErwinSchmidt17</a>, <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/14479">@ekopalypse</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@peterjones</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">Sorry, to be <strong>late</strong> as I’m on a family <strong>vacation</strong> right now, for the better part of <strong>August</strong> ;-))</p>
<hr />
<p dir="auto"><strong>Quickly</strong>, about solutions to <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19281">@ErwinSchmidt17</a>’s problem, I would say :</p>
<p dir="auto">SEARCH <strong><code>(?-s)(^.+projectID:1234.+pf2|\G).*?\K11(?=.*pf3)</code></strong></p>
<p dir="auto">REPLACE <strong><code>22</code></strong></p>
<p dir="auto">Thus, the <strong>test</strong> data, below, containing <strong><code>4</code></strong> names <strong>11.png</strong>, in the <strong><code>pf2</code></strong> section :</p>
<pre><code class="language-z">{name:11.png,filename:c:\img\11\11.png,projectID:1234},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:11.png,spfilename:11.png,bla_blah:11.png,test:11.png},pf3:{spname:11.png,spfilename:11.png},pf4:{...}
</code></pre>
<p dir="auto">would be changed as :</p>
<pre><code class="language-z">{name:11.png,filename:c:\img\11\11.png,projectID:1234},pf1:{spname:11.png,spfilename:11.png},pf2:{spname:22.png,spfilename:22.png,bla_blah:22.png,test:22.png},pf3:{spname:11.png,spfilename:11.png},pf4:{...}
</code></pre>
<hr />
<p dir="auto">Now, about the different syntaxes, related to <strong>groups</strong>, <strong>back-references</strong> and <strong>subroutine calls</strong>, I did some <strong>tests</strong> and here are my conclusions, <strong>not</strong> definitive, of course :</p>
<p dir="auto">In <strong>search</strong> regexes, the possible syntaxes, with <strong><code>Boost</code></strong> regex library, are :</p>
<ul>
<li>
<p dir="auto"><strong>Unnamed</strong> <strong><code>group</code></strong> is defined with surrounding <strong>parentheses</strong> : <strong><code>(.....)</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Named</strong> <strong><code>group</code></strong> is defined with the <strong>one</strong> of the syntaxes :</p>
<ul>
<li>
<p dir="auto"><strong><code>(?&lt;Name&gt;.....)</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>(?'Name'.....)</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Absolute</strong> <strong><code>back-reference</code></strong>, to an <strong>unnamed</strong> group <strong><code>N</code></strong>, is defined with <strong>one</strong> of the syntaxes :</p>
<ul>
<li>
<p dir="auto"><strong><code>\N</code></strong>    ( with <strong><code>1 &lt;= </code>N<code> &lt;= 9</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong><code>\gN</code></strong>    <strong><code>\g{N}</code></strong>    <strong><code>\g&lt;N&gt;</code></strong>    <strong><code>\g'N'</code></strong>    ( with <strong><code>1 &lt;= </code>N<code> &lt;= Max</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong><code>\kN</code></strong>    <strong><code>\k{N}</code></strong>    <strong><code>\k&lt;N&gt;</code></strong>    <strong><code>\k'N'</code></strong>    ( with <strong><code>1 &lt;= </code>N<code> &lt;= Max</code></strong> )</p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Relative</strong> <strong><code>back-reference</code></strong>, to an <strong>unnamed</strong> group <strong><code>X</code></strong>, is defined with <strong>one</strong> of the syntaxes :</p>
<ul>
<li>
<p dir="auto"><strong><code>\g-X</code></strong>    <strong><code>\g{-X}</code></strong>    <strong><code>\g&lt;-X&gt;</code></strong>    <strong><code>\g'-X'</code></strong>    ( with <strong><code>1 &lt; </code>X<code> &lt;= Max</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong><code>\k-X</code></strong>    <strong><code>\k{-X}</code></strong>    <strong><code>\k&lt;-X&gt;</code></strong>    <strong><code>\k'-X'</code></strong>    ( with <strong><code>1 &lt; </code>X<code> &lt;= Max</code></strong> )</p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Absolute</strong> <strong><code>subroutine call</code></strong>, to an <strong>unnamed</strong> group <strong><code>N</code></strong>, is defined with the syntax :</p>
<ul>
<li><strong><code>(?N)</code></strong>    ( with <strong><code>0 &lt;= </code>N<code> &lt; Max</code></strong> )</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Relative</strong> <strong><code>subroutine call</code></strong>, to an <strong>unnamed</strong> group of <strong>relative</strong> number <strong><code>X</code></strong>, is defined with <strong>one</strong> of the syntaxes :</p>
<ul>
<li>
<p dir="auto"><strong><code>(?-X)</code></strong>    ( with <strong><code>1 &lt; </code>X<code> &lt;= Max</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong><code>(?+X)</code></strong>    ( with <strong><code>1 &lt; </code>X<code> &lt;= Max</code></strong> )</p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Absolute</strong> <strong><code>back-reference</code></strong>, to a <strong>named</strong> group <strong><code>Name</code></strong>, is defined with <strong>one</strong> of the syntaxes :</p>
<ul>
<li>
<p dir="auto"><strong><code>\g{Name}</code></strong>    <strong><code>\g&lt;Name&gt;</code></strong>    <strong><code>\g'Name'</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>\k{Name}</code></strong>    <strong><code>\k&lt;Name&gt;</code></strong>    <strong><code>\k'Name'</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Absolute</strong> <strong><code>subroutine call</code></strong>, to a <strong>named</strong> group <strong><code>Name</code></strong>, is defined with <strong>one</strong> of the syntaxes :</p>
<ul>
<li>
<p dir="auto"><strong><code>(?&amp;Nom)</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>(?P&gt;Nom)</code></strong></p>
</li>
</ul>
</li>
</ul>
<hr />
<p dir="auto"><strong>Remarks</strong> :</p>
<ul>
<li>
<p dir="auto">For all the <strong>relative</strong> syntaxes above, the <strong><code>Max</code></strong> value is the <strong>greatest</strong> group of the <strong>overall</strong> regex</p>
</li>
<li>
<p dir="auto">For all the <strong>absolute</strong> syntaxes, I suppose that the <strong><code>Max</code></strong> value is <strong><code>2,147,483,647</code></strong>, as it’s the <strong>same</strong> value in <strong>replacement</strong>, too !</p>
</li>
<li>
<p dir="auto">The names of <strong>named</strong> groups are <strong>word</strong> characters, <strong>non</strong> beginning with a <strong>digit</strong></p>
</li>
<li>
<p dir="auto">The <strong><code>(?0)</code></strong> is a <strong>subroutine call</strong> to the <strong>overall</strong> regex and is, implicitly, a <strong>recursive</strong> subroutine call !</p>
</li>
</ul>
<p dir="auto"><strong>Summary</strong> example :</p>
<p dir="auto">To find a <strong>four</strong>-letters word <strong>palindrome</strong>, you can use, either, one of these <strong><code>23</code></strong> syntaxes :</p>
<p dir="auto"><strong><code>\b(\w)(\w)\2\1\b</code></strong></p>
<p dir="auto"><strong><code>\b(\w)(\w)\g2\g1\b</code></strong><br />
<strong><code>\b(\w)(\w)\g{2}\g{1}\b</code></strong><br />
<strong><code>\b(\w)(\w)\g&lt;2&gt;\g&lt;1&gt;\b</code></strong><br />
<strong><code>\b(\w)(\w)\g'2'\g'1'\b</code></strong></p>
<p dir="auto"><strong><code>\b(\w)(\w)\k2\k1\b</code></strong><br />
<strong><code>\b(\w)(\w)\k{2}\k{1}\b</code></strong><br />
<strong><code>\b(\w)(\w)\k&lt;2&gt;\k&lt;1&gt;\b</code></strong><br />
<strong><code>\b(\w)(\w)\k'2'\k'1'\b</code></strong></p>
<p dir="auto"><strong><code>\b(\w)(\w)\g-1\g-2\b</code></strong><br />
<strong><code>\b(\w)(\w)\g{-1}\g{-2}\b</code></strong><br />
<strong><code>\b(\w)(\w)\g&lt;-1&gt;\g&lt;-2&gt;\b</code></strong><br />
<strong><code>\b(\w)(\w)\g'-1'\g'-2'\b</code></strong></p>
<p dir="auto"><strong><code>\b(\w)(\w)\k-1\k-2\b</code></strong><br />
<strong><code>\b(\w)(\w)\k{-1}\k{-2}\b</code></strong><br />
<strong><code>\b(\w)(\w)\k&lt;-1&gt;\k&lt;-2&gt;\b</code></strong><br />
<strong><code>\b(\w)(\w)\k'-1'\k'-2'\b</code></strong></p>
<p dir="auto"><strong><code>\b(?&lt;First&gt;\w)(?'Second'\w)\g{Second}\g{First}\b</code></strong><br />
<strong><code>\b(?&lt;First&gt;\w)(?'Second'\w)\g&lt;Second&gt;\g&lt;First&gt;\b</code></strong><br />
<strong><code>\b(?&lt;First&gt;\w)(?'Second'\w)\g'Second'\g'First'\b</code></strong></p>
<p dir="auto"><strong><code>\b(?'First'\w)(?&lt;Second&gt;\w)\k{Second}\k{First}\b</code></strong><br />
<strong><code>\b(?'First'\w)(?&lt;Second&gt;\w)\k&lt;Second&gt;\k&lt;First&gt;\b</code></strong><br />
<strong><code>\b(?'First'\w)(?&lt;Second&gt;\w)\k'Second'\k'First'\b</code></strong></p>
<p dir="auto"><strong>Test</strong> them against this text :</p>
<pre><code class="language-z">adda – a type of lizard
Adda – a river in Italy; a river in Wales
Anna – a girl’s name
Beeb – an informal name for the BBC
boob – a blunder; a breast
deed – various common meanings
goog – an egg (Australian slang)
immi – a Swiss unit of volume
keek – to peep
kook – a crazy person
naan – a type of Indian bread
noon – midday
Otto - a proper name
peep – various common meanings
poop – a raised deck at the stern of a ship; various other meanings
toot – the sound made by a horn or whistle
</code></pre>
<p dir="auto">Now, as a <strong>subroutine call</strong> is, basically, a <strong>reference</strong> to the regex <strong>itself</strong>, included in a group and <em>NOT</em> the <strong>last</strong> value of this group like in <strong>back-references</strong>, the <strong><code>5</code></strong> following syntaxes are <strong>strictly</strong> equivalent to the simple regex <strong><code>\b\w{4}\b</code></strong> and looks for a <strong>four</strong>-letters <strong>word</strong> :</p>
<p dir="auto"><strong><code>\b(\w)(\w)(?2)(?1)\b</code></strong><br />
<strong><code>\b(\w)(\w)(?-1)(?-2)\b</code></strong><br />
<strong><code>\b(?+2)(?+1)(\w)(\w)\b</code></strong></p>
<p dir="auto"><strong><code>\b(?&lt;First&gt;\w)(?'Second'\w)(?&amp;Second)(?&amp;First)\b</code></strong><br />
<strong><code>\b(?'First'\w)(?&lt;Second&gt;\w)(?P&gt;Second)(?P&gt;First)\b</code></strong></p>
<p dir="auto">Test them, again, on the same <strong>sample</strong> text, above !</p>
<p dir="auto"><strong>Important</strong> :</p>
<ul>
<li>
<p dir="auto"><strong>All</strong> the syntaxes, above, are <strong>valid</strong> in <strong><code>search</code></strong> part <em>ONLY</em> !</p>
</li>
<li>
<p dir="auto">Because of the <strong>multiple equivalent</strong> syntaxes, for <strong>groups</strong>, <strong>back-references</strong> and <strong>subroutine calls</strong>, it is useful to define, for <strong><code>search</code></strong> regexes, a <strong>single, minimal</strong> syntax, covering the <strong>majority</strong> of cases :</p>
</li>
</ul>
<p dir="auto">Hence, the table, below, with my <strong>preferences</strong> :</p>
<pre><code class="language-z">    •============================•=============================•===================•====================•
    |           GROUP            |          REFERENCE          |  ABSOLUTE number  |  RELATIVE number   |
    •============================•=============================•===================•====================•
    |                            |       BACK-REFERENCE        |  \N   or   \g{N}  |       \g{-X}       |
    |  (.....)          UNNAMED  |                             |                   |                    |
    |                            |       SUBROUTINE CALL       |       (?N)        |  (?-X)  or  (?-X)  |
    •----------------------------•-----------------------------•-------------------•--------------------•
    |                            |       BACK-REFERENCE        |     \g&lt;Name&gt;      |        N/A         |
    |  (?&lt;Name&gt;.....)     NAMED  |                             |                   |                    |
    |                            |       SUBROUTINE CALL       |     (?&amp;Name)      |        N/A         |
    •============================•=============================•===================•====================•
</code></pre>
<hr />
<p dir="auto">In <strong>replacement</strong> regexes, , with <strong><code>Boost</code></strong> regex library, you can use the following syntaxes :</p>
<ul>
<li>
<p dir="auto"><strong>Absolute</strong> <strong><code>reference</code></strong>, to an <strong>unnamed</strong> group <strong><code>N</code></strong>, is defined with either :</p>
<ul>
<li>
<p dir="auto"><strong><code>\N</code></strong>    ( with <strong><code>1 &lt;= </code>N<code> &lt;= 9</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong><code>$N</code></strong>    ( with <strong><code>0 &lt;= </code>N<code> &lt;= 2,147,483,647</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong><code>${N}</code></strong>    ( with <strong><code>0 &lt;= </code>N<code> &lt;= 2,147,483,647</code></strong> )</p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Absolute</strong> <strong><code>reference</code></strong>, to an <strong>named</strong> group <strong><code>Name</code></strong>, is defined with the syntax :</p>
<ul>
<li><strong><code>$+{Name}</code></strong></li>
</ul>
</li>
</ul>
<p dir="auto"><strong>Remarks</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong><code>$0</code></strong>  or <strong><code>$&amp;</code></strong> syntaxes refer to the <strong>overall</strong> regex, itself</p>
</li>
<li>
<p dir="auto">If number <strong><code>N</code></strong> is <strong>superior</strong>  to the number of <strong>back-references</strong>, in the <strong>search</strong> regex, these syntaxes return an <strong>empty</strong> string</p>
</li>
<li>
<p dir="auto">If a <strong>named</strong> reference <strong><code>$+{name}</code></strong> does not exist in <strong>search</strong> regex, it also returns an <strong>empty</strong> string</p>
</li>
<li>
<p dir="auto">If, in the <strong>replacement</strong> regex, a digit <strong>follows</strong> a <strong><code>$N</code></strong> syntax, it’s preferable to use the <strong><code>${N}</code></strong> form !</p>
</li>
<li>
<p dir="auto">The <strong><code>$00...00N</code></strong> and <strong><code>${00...00N}</code></strong> syntaxes are <strong>equivalent</strong> to, respectively, the <strong><code>$N</code></strong> and <strong><code>${N}</code></strong> syntaxes</p>
</li>
<li>
<p dir="auto">So, the <strong>single minimal</strong> syntaxes, in <strong>replacement</strong>, seems to be :</p>
</li>
</ul>
<pre><code class="language-z">    •============================•==================•===================•
    |           GROUP            |     REFERENCE    |  ABSOLUTE number  |
    •============================•==================•===================•
    |  (.....)          UNNAMED  |  BACK-REFERENCE  |       ${N}        |
    •----------------------------•------------------•-------------------•
    |  (?&lt;Name&gt;.....)     NAMED  |  BACK-REFERENCE  |     $+{Name}      |
    •============================•==================•===================•
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56447</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56447</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 04 Aug 2020 23:08:30 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Thu, 30 Jul 2020 14:44:33 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for all your answers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56325</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56325</guid><dc:creator><![CDATA[ErwinSchmidt17]]></dc:creator><pubDate>Thu, 30 Jul 2020 14:44:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 21:02:38 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">maybe that is implementation detail (!?)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56281</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56281</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 28 Jul 2020 21:02:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 21:00:23 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>
<p dir="auto">Haha, well, that’s why I said “fairly” certain.</p>
<p dir="auto">Actually, I cheated:  Long ago I read about RegexBuddy here on the Community (at least I think it was here), and purchased a license.  It has proved invaluable.</p>
<p dir="auto">Here’s what it told me for this case:</p>
<p dir="auto"><img src="/assets/uploads/files/1595969726930-f46cfd71-179a-448b-8be0-0581dc05baad-image.png" alt="f46cfd71-179a-448b-8be0-0581dc05baad-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I should have cited RB a few minutes ago when I posted, but I wanted to see if there was agreement/disagreement first.</p>
<p dir="auto">Very rarely have I found any discrepancies between RB and N++, but this may be one of those cases.</p>
<p dir="auto">It is interesting that RB doesn’t say “Insert the character string 22 literally” in the second and third lines of its output, but breaks it into 2 parts…hmmm…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56280</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56280</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 28 Jul 2020 21:00:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:57:09 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/56277">How to replace text at a special place in special rows?</a>:</p>
<blockquote>
<p dir="auto">\g notation</p>
</blockquote>
<p dir="auto">To confirm: I can successfully search <code>0123456789ABCDEFB</code> using the regex <code>(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)\g12</code>, and it matches (because the 17th character matches the 12th backref)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56279</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56279</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:57:09 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:55:16 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/56276">How to replace text at a special place in special rows?</a>:</p>
<blockquote>
<p dir="auto">what we could do in addition is<br />
replace with:<code>($12)2</code></p>
</blockquote>
<p dir="auto">Equivalently: <strong>replace with:</strong> <code>${12}2</code></p>
<blockquote>
<p dir="auto">I can’t seem to get the \g notation to work either.<br />
replace with:<code>\g{12}2</code></p>
</blockquote>
<p dir="auto">In Boost, <code>\g</code>-notation is only listed in the SEARCH section, <em>not</em> in the  REPLACE section (fixed typo).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56278</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56278</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:55:16 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:53:44 GMT]]></title><description><![CDATA[<p dir="auto">I can’t seem to get the \g notation to work either.<br />
replace with:<code>\g{12}2</code><br />
results in <code>g{12}2</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/56277</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56277</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:53:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:51:50 GMT]]></title><description><![CDATA[<p dir="auto">what we could do in addition is<br />
replace with:<code>($12)2</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/56276</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56276</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:51:50 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:50:03 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/56274">How to replace text at a special place in special rows?</a>:</p>
<blockquote>
<p dir="auto">I’m fairly certain it works like this:</p>
</blockquote>
<p dir="auto">I don’t think so.<br />
Having the text</p>
<pre><code class="language-z">0123456789ABCDEF
</code></pre>
<p dir="auto">and doing<br />
find what:<code>(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)</code><br />
replace with:<code>$122</code><br />
doesn’t result in <code>B2</code><br />
but<br />
replace with:<code>$12 2</code><br />
results in <code>B 2</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/56275</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56275</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:50:03 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:46:03 GMT]]></title><description><![CDATA[<p dir="auto">I’m fairly certain it works like this:</p>
<p dir="auto"><code>\122</code> --&gt; group 1 and then a literal <code>22</code></p>
<p dir="auto"><code>$122</code> --&gt; group 12 and then a literal <code>2</code></p>
<p dir="auto"><code>${122}</code> --&gt; group 122</p>
<p dir="auto">Obviously, the group numbers need to exist for it to work.</p>
<p dir="auto">The good habit to get into is to always use the curly brace syntax, so, for example from the current discussion:  <code>${1}22</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/56274</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56274</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:46:03 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:41:27 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> , <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a> , and all interested parties:</p>
<p dir="auto">From my understanding (as reflected in the <a href="https://npp-user-manual.org/docs/searching/#capture-groups-and-backreferences" rel="nofollow ugc">Searching: capture groups and backreferences</a> and <a href="https://npp-user-manual.org/docs/searching/#substitutions" rel="nofollow ugc">substitutions</a> docs), the <code>\ℕ</code> notation only accepts single-digit.  In the search string, you can use one of the more verbose backreferences (<code>\gℕ</code>, <code>\g{ℕ}</code>, <code>\g&lt;ℕ&gt;</code>, <code>\g'ℕ'</code>, <code>\kℕ</code>, <code>\k{ℕ}</code>, <code>\k&lt;ℕ&gt;</code> or <code>\k'ℕ'</code>).</p>
<p dir="auto">The Boost 1.70 docs confirm: <a href="https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.back_references" rel="nofollow ugc">back references</a> says that in the <code>\ℕ</code> form, <code>ℕ</code> must be in the range 1-9; the <code>\g</code>-variants (especially with <code>\g{ℕ}</code> allow for higher <code>ℕ</code> values (the <code>\k</code>-variants are supposed to be for named groups, but they also work for numbered groups at last experimentation).  The Boost <a href="https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html#boost_regex.format.boost_format_syntax.placeholder_sequences" rel="nofollow ugc">replacement: placeholder sequences</a> only mentions <code>$ℕ</code> and <code>${ℕ}</code>, and do not mention <code>\ℕ</code>-notation at all in the substitution/replacement syntax.</p>
<p dir="auto">My rule of thumb is to exclusively use <code>$ℕ</code> or <code>${ℕ}</code> in replacements, and I use the <code>${ℕ}</code> more often, because it is 100% unambiguous for reading (even though it is harder to type on my keyboard).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56273</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56273</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:41:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:16:14 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/56271">How to replace text at a special place in special rows?</a>:</p>
<blockquote>
<p dir="auto">$122 wouldn’t work</p>
</blockquote>
<p dir="auto">From the little I have read I would think the <code>\</code> means take “as few numbers following as possible”, whereas the $ might be "more greedy, sort of like the <code>*</code> and <code>+</code> quantifiers within regex. I think it did see that we can also use <code>(</code> and <code>)</code> to force the system to recognise what we actually want.</p>
<p dir="auto">This might be another case of becoming a bit more particular such as the <code>(?-s)</code> which I admit is still something I HAVE to think about, otherwise I forget. Especially as I know my own environment and rarely use it “at home”.</p>
<p dir="auto">Perhaps <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> can supply the “answer”?</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56272</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56272</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:16:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 20:04:28 GMT]]></title><description><![CDATA[<p dir="auto">I recently found out that there is a difference in handling when using \1 vs. $1.<br />
In this example \122 the 22 to would be added to the captured text from \1 but $122 wouldn’t work.<br />
I assume it treats this as the 122nd capturing group.<br />
Any idea why this is so?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56271</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56271</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 28 Jul 2020 20:04:28 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 19:50:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19281">@ErwinSchmidt17</a> said in <a href="/post/56267">How to replace text at a special place in special rows?</a>:</p>
<blockquote>
<p dir="auto">So how can this been done</p>
</blockquote>
<p dir="auto">Building on <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a>  solution I’d extend the regex slightly to change both occurances of the 11 at the same time if the conditions are met. Thus my Replace function would be<br />
Find What:<code>(?-s)^((.+)?projectID:1234(.+)?pf2:\{[^}]+?)11([^}]+?)11</code><br />
Replace With:<code>\122\422</code></p>
<p dir="auto">From your example it would appear the 11 will ALWAYS occur twice in the “pf2” section (between { and }) if it does exist at all. So my regex prevents running into the next section “pf3” with the use of <code>[^}]</code>. This means take any characters as long as they are NOT the <code>}</code>. So you will only need to press the “Replace All” button once to have all the occurances replaced.</p>
<p dir="auto">If unsure of my regex you can also use it to bookmark the lines containing the conditions. Then you could step through the lines to confirm. Alternatively you could use the “Replace” button to change 1 line at a time. Use the "Find button at the start, then the replace button from there on and you will see each line selected in turn.</p>
<p dir="auto">Another method of achieving the same result, but taking more steps to do so are:</p>
<ol>
<li>add a line number (with leading zeroes) at the start of each line (Edit, Column editor)</li>
<li>Bookmark the lines containing the first condition.</li>
<li>Cut these lines out and insert into another empty file.</li>
<li>Continue with editing these lines based on the second condition.</li>
<li>Copy these lines back to the original file and sort numerically, thus the line number at start puts them back into the correct sequence.</li>
<li>Remove the line numbers at the start of a line.</li>
<li>Finished. You see, by breaking down the problem into several smaller steps you can achieve the desired result.</li>
</ol>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56270</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56270</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Tue, 28 Jul 2020 19:50:01 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace text at a special place in special rows? on Tue, 28 Jul 2020 18:42:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/19281">@ErwinSchmidt17</a></p>
<p dir="auto">from the given example I assume the following will do what you want to achieve.</p>
<p dir="auto">find what:<code>(?&lt;=projectID:1234}).*(?&lt;=pf2).*?\K11(?=.*pf3)</code><br />
replace with:<code>22</code></p>
<p dir="auto">And you must press replace all until npp reports that no more matches are found.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56268</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56268</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 28 Jul 2020 18:42:24 GMT</pubDate></item></channel></rss>