<?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[Fin&#x2F;Replace in Determined Lines]]></title><description><![CDATA[<p dir="auto">Hi, I need a way to find/replace text ONLY in lines that start for determined string.</p>
<p dir="auto">Ex.</p>
<p dir="auto">key= bla bla<br />
value= bla bla</p>
<p dir="auto">Replace “bla” in “blue” ONLY in strings that start for “value=”</p>
<p dir="auto">Can anyone help me?</p>
<p dir="auto">Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/11447/fin-replace-in-determined-lines</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 20:44:01 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/11447.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 10 Mar 2016 09:56:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fin&#x2F;Replace in Determined Lines on Sun, 27 Mar 2016 23:59:34 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Fabrizio</strong> and <strong>All</strong>,</p>
<p dir="auto">From your post, I tried to find a <strong>generic</strong> way to achieve this kind of question, with <strong>regexes</strong> ! Please, just consider my solution as, only, one, <strong>among all</strong> the possible solutions !</p>
<p dir="auto">The <strong>Fabrizio</strong>’s goal is to perform a <strong>Search/Replacement</strong> on a line, <strong>ONLY IF</strong> a <strong>SPECIFIC condition</strong> is <strong>true</strong> on that particular line</p>
<p dir="auto">I would use the general regex syntax, below :</p>
<pre><code>(Regex_Condition)[^@\r\n]*$|(Search_Regex)(?=.*@)|@

(?1$0@)(?2Replacement_Regex)
</code></pre>
<p dir="auto"><strong>IMPORTANT</strong> :</p>
<ul>
<li>
<p dir="auto">Go back to the <strong>very beginning</strong> of your <strong>current</strong> file</p>
</li>
<li>
<p dir="auto">In the <strong>Replace</strong> dialog, check the <strong>Regular</strong> search mode</p>
</li>
<li>
<p dir="auto">Check, preferably, the <strong>Match case</strong> option</p>
</li>
<li>
<p dir="auto">Click <strong><code>TWICE</code></strong> on the <strong>Replace All</strong> button</p>
</li>
</ul>
<p dir="auto"><strong>NOTES</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>arobase</strong> character <strong><code>@</code></strong>, is, simply, any <strong>single</strong> character, which <strong>DOES NOT</strong> exist in your current file. and preferably, <strong>NOT</strong> a <strong>meta-character</strong> of <strong>regular</strong> expressions. So, according to your file’s contents, you can choose, for instance, the <strong><code>!</code></strong> character, the <strong><code>#</code></strong> character, the <strong><code>%</code></strong> character, the <strong><code>&amp;</code></strong> character, the <strong><code>=</code></strong> character,  the <strong><code>_</code></strong> character, …</p>
</li>
<li>
<p dir="auto"><strong><code>Regex_Condition</code></strong> represents the regex that satisfies the <strong>specific</strong> condition, which allows the associated <strong>Search/Replacement</strong>. Of course, <strong><code>Regex_Condition</code></strong> may be, also, a simple <strong>literal</strong> string, even a <strong>single</strong> character !</p>
</li>
<li>
<p dir="auto"><strong><code>Search_Regex</code></strong> represents, of course, the area of text, which will be replaced. As above, <strong><code>Search_Regex</code></strong> may be, only, a simple <strong>literal</strong> string, even a <strong>single</strong> character !</p>
</li>
<li>
<p dir="auto"><strong><code>Replacement_Regex</code></strong> is, obviously, the regex to <strong>generate</strong> the text that will <strong>replace</strong> the area matched by the <strong><code>Search_Regex</code></strong></p>
</li>
</ul>
<hr />
<p dir="auto">Below, I’ll expose 3 <strong>different</strong> examples ( The <strong>Fabrizio</strong>’s one and <strong>two</strong> others )</p>
<pre><code>Regex_Condition :   ^Value=                     Search_Regex :   \bbla\b               Replacement_Regex :   blue 

Regex_Condition :   \b\d\d-\d\d-\d\d\b          Search_Regex :   [a-z]                 Replacement_Regex :   \u\2 

Regex_Condition :   \d$                         Search_Regex :   &lsqb;&lsqb;:alpha:&rsqb;&rsqb;+          Replacement_Regex :   &lt;\2&gt; 
</code></pre>
<ul>
<li>
<p dir="auto">In the <strong>first</strong> case, we’ll replace the <strong>lowercase</strong> word <strong>bla</strong>, with the word <strong>blue</strong>, ONLY on lines <strong>beginning</strong> with the <strong>exact</strong> string <strong>Value=</strong><br />
( <strong>Fabrizio</strong>’s problem )</p>
</li>
<li>
<p dir="auto">In the <strong>second</strong> case, we’ll replace any <strong>lowercase</strong> letter, with the <strong>same uppercase</strong> letter, ONLY on lines that contain a <strong>date</strong>, of the general form <strong>xx-xx-xx</strong>, at <strong>any</strong> position of the line</p>
</li>
<li>
<p dir="auto">In the <strong>third</strong> case, we’ll replace any set of <strong>uppercase</strong> or <strong>lowercase</strong> letters, with the <strong>same</strong> set, surrounded by the two <strong>angle</strong> brackets, ONLY, if the current line <strong>ends</strong> with a <strong>digit</strong></p>
</li>
</ul>
<hr />
<p dir="auto">To see the results of <strong>each</strong> example, I’ll use the <code>SAME</code> <strong>10 lines test</strong> example, below :</p>
<pre><code>Value= bla bla testblatest bla
That's only "bla bla" speech
My NEXT bithday falls on 19-05-16
Every 25-12, Chistmas is celebrated
Value= Test of bla and BLA
Christmas is celebrated each 25-12
On the 01-01-17, we'll wish a Good New Year
Don't change the word "bla", in that TEST line no 8
01-01-00 was the first day OF THAT century
Value=     bla blabla bla
</code></pre>
<hr />
<p dir="auto">So the <strong>first</strong> example :</p>
<pre><code>(^Value=)[^@\r\n]*$|(\bbla\b)(?=.*@)|@

(?1$0@)(?2blue)
</code></pre>
<p dir="auto">would give the changed text ( Lines <strong>1</strong>, <strong>5</strong> and <strong>10</strong> ), below :</p>
<pre><code>Value= blue blue testblatest blue
That's only "bla bla" speech
My NEXT bithday falls on 19-05-16
Every 25-12, Chistmas is celebrated
Value= Test of blue and BLA
Christmas is celebrated each 25-12
On the 01-01-17, we'll wish a Good New Year
Don't change the word "bla", in that TEST line no 8
01-01-00 was the first day OF THAT century
Value=     blue blabla blue
</code></pre>
<p dir="auto">The <strong>second</strong> example :</p>
<pre><code>(\b\d\d-\d\d-\d\d\b)[^@\r\n]*$|([a-z])(?=.*@)|@

(?1$0@)(?2\u\2)
</code></pre>
<p dir="auto">would give the changed text ( Lines <strong>3</strong>, <strong>7</strong> and <strong>9</strong> ), below :</p>
<pre><code>Value= bla bla testblatest bla
That's only "bla bla" speech
MY NEXT BITHDAY FALLS ON 19-05-16
Every 25-12, Chistmas is celebrated
Value= Test of bla and BLA
Christmas is celebrated each 25-12
ON THE 01-01-17, WE'LL WISH A GOOD NEW YEAR
Don't change the word "bla", in that TEST line no 8
01-01-00 WAS THE FIRST DAY OF THAT CENTURY
Value=     bla blabla bla
</code></pre>
<p dir="auto">Finally, the <strong>third</strong> example :</p>
<pre><code>(\d$)[^@\r\n]*$|(&lsqb;&lsqb;:alpha:&rsqb;&rsqb;+)(?=.*@)|@

(?1$0@)(?2&lt;\2&gt;)
</code></pre>
<p dir="auto">would give the changed text ( Lines <strong>3</strong>, <strong>6</strong> and <strong>8</strong> ), below :</p>
<pre><code>Value= bla bla testblatest bla
That's only "bla bla" speech
&lt;My&gt; &lt;NEXT&gt; &lt;bithday&gt; &lt;falls&gt; &lt;on&gt; 19-05-16
Every 25-12, Chistmas is celebrated
Value= Test of bla and BLA
&lt;Christmas&gt; &lt;is&gt; &lt;celebrated&gt; &lt;each&gt; 25-12
On the 01-01-17, we'll wish a Good New Year
&lt;Don&gt;'&lt;t&gt; &lt;change&gt; &lt;the&gt; &lt;word&gt; "&lt;bla&gt;", &lt;in&gt; &lt;that&gt; &lt;TEST&gt; &lt;line&gt; &lt;no&gt; 8
01-01-00 was the first day OF THAT century
Value=     bla blabla bla
</code></pre>
<p dir="auto"><strong>NOTES</strong> :</p>
<ul>
<li>
<p dir="auto">Throughout these <strong>3</strong> examples, the lines <strong>2</strong> and <strong>4</strong>, which do not begin with the string <strong>Value=</strong> nor end with a <strong>digit</strong> and which do not contain any <strong>date</strong>, remain <strong>UNCHANGED</strong></p>
</li>
<li>
<p dir="auto">For a <strong>correct</strong> behaviour of the proposed regexes, don’t forget to click, <strong><code>TWICE</code></strong>, on the <strong>Replace All</strong> button</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">The <strong>underlined</strong> idea, about these general regexes, below :</p>
<pre><code>(Regex_Condition)[^@\r\n]*$|(Search_Regex)(?=.*@)|@

(?1$0@)(?2Replacement_Regex)
</code></pre>
<p dir="auto">is :</p>
<ul>
<li>
<p dir="auto">Add a specific character ( <strong><code>@</code></strong>, or else, not used in <strong>current</strong> file ) at the <strong>end</strong> of <strong>EACH</strong> line that satisfies the <strong><code>Regex_Condition</code></strong> ( <strong>1st</strong> S/R )</p>
</li>
<li>
<p dir="auto">Perform the wanted S/R, <strong>ONLY</strong> on the lines that <strong>end</strong> with the <strong><code>@</code></strong> character ( or else ) and finally delete that <strong>extra</strong> character, at the <strong>end</strong> of <strong>each</strong> concerned line ( <strong>2nd</strong> S/R )</p>
</li>
</ul>
<p dir="auto">As usual, I could give some <strong>extra</strong> information about these regexes, if needed !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14944</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14944</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 27 Mar 2016 23:59:34 GMT</pubDate></item><item><title><![CDATA[Reply to Fin&#x2F;Replace in Determined Lines on Thu, 10 Mar 2016 17:50:59 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/fabrizio-ferraro" aria-label="Profile: Fabrizio-Ferraro">@<bdi>Fabrizio-Ferraro</bdi></a>,</p>
<p dir="auto">sounds like a regex topic but solution depends on how line exactly looks.<br />
E.g. from regex point of view it is different if line is value=bla or value = bla.<br />
So without knowing how the lines are exactly we can only provide a roughly answer like mark regular expression in search mode and search for<br />
(value=)bla bla and replace with \1blue.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14643</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14643</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Thu, 10 Mar 2016 17:50:59 GMT</pubDate></item><item><title><![CDATA[Reply to Fin&#x2F;Replace in Determined Lines on Thu, 10 Mar 2016 17:18:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/allan-biggs" aria-label="Profile: Allan-Biggs">@<bdi>Allan-Biggs</bdi></a> said:</p>
<blockquote>
<p dir="auto">in the search box<br />
\nvalue=</p>
<p dir="auto">and select radio button</p>
<p dir="auto">extended \n,\r</p>
<p dir="auto">worked for me - this was a DEC EVE feature great to see it in here</p>
</blockquote>
<p dir="auto">Oh just read your post properly - guess that’s not what you want.</p>
<p dir="auto">On Unix you could use grep etc</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14641</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14641</guid><dc:creator><![CDATA[Allan Biggs]]></dc:creator><pubDate>Thu, 10 Mar 2016 17:18:16 GMT</pubDate></item><item><title><![CDATA[Reply to Fin&#x2F;Replace in Determined Lines on Thu, 10 Mar 2016 16:26:30 GMT]]></title><description><![CDATA[<p dir="auto">in the search box<br />
\nvalue=</p>
<p dir="auto">and select radio button</p>
<p dir="auto">extended \n,\r</p>
<p dir="auto">worked for me - this was a DEC EVE feature great to see it in here</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14637</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14637</guid><dc:creator><![CDATA[Allan Biggs]]></dc:creator><pubDate>Thu, 10 Mar 2016 16:26:30 GMT</pubDate></item></channel></rss>