<?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 a specific text in lines that contains a specific word.]]></title><description><![CDATA[<p dir="auto">I have a config file, that i want to manipulate with notepad++.<br />
It contains lines like this:</p>
<p dir="auto">railcraft {<br />
B:dustCharcoal_false=false<br />
B:dustObsidian_false=false<br />
B:dustSaltpeter_false=false<br />
B:dustSulfur_false=false<br />
B:ingotCopper_false=false<br />
B:ingotLead_false=false<br />
B:ingotSteel_false=false<br />
B:ingotTin_false=false<br />
B:nuggetCopper_false=false<br />
B:nuggetIron_false=false<br />
B:nuggetLead_false=false<br />
B:nuggetSteel_false=false<br />
B:nuggetTin_false=false<br />
B:plateCopper_true=true<br />
B:plateIron_true=true<br />
B:plateSteel_true=true<br />
B:plateTinAlloy_true=true<br />
}</p>
<p dir="auto">What i want to do, is to replace all the “=false” texts to “=true” in lines, that contains the word “ingot”.</p>
<p dir="auto">For example this block of text after the replace would look like this:</p>
<p dir="auto">railcraft {<br />
B:dustCharcoal_false=false<br />
B:dustObsidian_false=false<br />
B:dustSaltpeter_false=false<br />
B:dustSulfur_false=false<br />
B:ingotCopper_false=true<br />
B:ingotLead_false=true<br />
B:ingotSteel_false=true<br />
B:ingotTin_false=true<br />
B:nuggetCopper_false=false<br />
B:nuggetIron_false=false<br />
B:nuggetLead_false=false<br />
B:nuggetSteel_false=false<br />
B:nuggetTin_false=false<br />
B:plateCopper_true=true<br />
B:plateIron_true=true<br />
B:plateSteel_true=true<br />
B:plateTinAlloy_true=true<br />
}</p>
<p dir="auto">I started to learn about the search mechanism of notepad++, but it’s way too complex for me to figure it out. (i spent an hour learning it so far)<br />
Can you give me the syntax for this specific use case, and explain it too?</p>
<p dir="auto">Thanks in advance!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22424/how-to-replace-a-specific-text-in-lines-that-contains-a-specific-word</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 06:31:52 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22424.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Jan 2022 15:07:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Thu, 03 Feb 2022 15:39:15 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> said in <a href="/post/73276">How to replace a specific text in lines that contains a specific word.</a>:</p>
<blockquote>
<p dir="auto">First of all, at this time of the year, I am rather involved in ski, which is a passion of mine !</p>
</blockquote>
<p dir="auto">I’m not an excellent skier, but nothing sounds better to me right now than joining you on those slopes! :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73657</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73657</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 03 Feb 2022 15:39:15 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Wed, 26 Jan 2022 08:45:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>,</p>
<p dir="auto">You said :</p>
<blockquote>
<p dir="auto">You haven’t been very active lately.</p>
</blockquote>
<p dir="auto">You’re quite <strong>right</strong> ! Well, there’s a simple explanation to this :</p>
<ul>
<li>
<p dir="auto">First of all, at this time of the year, I am rather involved in <strong>ski</strong>, which is a <strong>passion</strong> of mine !</p>
</li>
<li>
<p dir="auto">Secondly, each <strong>Wednesday</strong>, with eight other people, we supervise , at the <strong><code>Chamrousse</code></strong> station,( the <strong>nearest</strong> from <strong>Grenoble</strong> ) <strong><code>50</code></strong> children about, from <strong>5</strong> to <strong>14</strong> years old, in ski lessons, for <strong>any</strong> level, from <strong><code>Débutants</code></strong> to <strong><code>Flèche de Bronze</code></strong> ( approximatively, from <strong>american</strong> ski level <strong><code>1</code></strong> to <strong><code>8</code></strong> : refer, for instance, <a href="https://www.tripsavvy.com/skiing-ability-levels-3007976" rel="nofollow ugc">https://www.tripsavvy.com/skiing-ability-levels-3007976</a> )</p>
</li>
<li>
<p dir="auto">And thirdly, <strong>last</strong> week-end, we were 13 people at <strong>Courchevel</strong>, a very well-known French station, with a wonderful <strong>sunny</strong> and <strong>blue</strong> weather ! Really, we had lunch, Sunday midday, on the terrace of the hotel and it was rather <strong>hot</strong>, at about <strong><code>1700 m</code></strong> !</p>
</li>
</ul>
<hr />
<p dir="auto">Next Thursday, we’ll be, for the day, at the <strong>Karellis</strong> station :</p>
<p dir="auto"><img src="/assets/uploads/files/1643110611769-336bbaaa-1d48-4162-8c0e-e1c9d44c7ba0-capture-d-%C3%A9cran-2022-01-25-122601.png" alt="336bbaaa-1d48-4162-8c0e-e1c9d44c7ba0-Capture d’écran 2022-01-25 122601.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Best regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73276</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73276</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 26 Jan 2022 08:45:54 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 21:56:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> said in <a href="/post/73258">How to replace a specific text in lines that contains a specific word.</a>:</p>
<blockquote>
<p dir="auto">So the (?-s) is a safety-valve on the expression, in this instance saying “everything must be on the same line”.</p>
</blockquote>
<p dir="auto">This sentence sums it up clearly, after this one i was sure i understood everything what you just wrote.<br />
I don’t know why did you ask whether i understood the \k fully, but i did.<br />
In fact everything was simple, what probably confused me, is that i did not catch what did you mean by “following .” i had no idea that by the dot you meant the whole search.</p>
<p dir="auto">Now everything is clear and i even have a greater understanding on some of the things, i read on the notepad++ wiki.<br />
Thanks!</p>
<p dir="auto">BS</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73262</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73262</guid><dc:creator><![CDATA[Zsombor Szarka]]></dc:creator><pubDate>Mon, 24 Jan 2022 21:56:40 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 21:25:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zsombor-szarka" aria-label="Profile: zsombor-szarka">@<bdi>zsombor-szarka</bdi></a> said in <a href="/post/73257">How to replace a specific text in lines that contains a specific word.</a>:</p>
<blockquote>
<p dir="auto">I understand everything except this</p>
</blockquote>
<p dir="auto">You even understand the <code>\K</code> fully?  :-)</p>
<p dir="auto">Ok so the <code>(?-s)</code> is equivalent to leaving this checkbox unchecked:</p>
<p dir="auto"><img src="/assets/uploads/files/1643058949053-711e0e73-4177-4d94-a12b-2ac637b4aed8-image.png" alt="711e0e73-4177-4d94-a12b-2ac637b4aed8-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">But what it <em>means</em> is that using a <code>.</code> further along in the expression will NOT match a line-ending character.</p>
<p dir="auto">When you originally said:</p>
<blockquote>
<p dir="auto">is to replace all the “=false” texts to “=true” in lines</p>
</blockquote>
<p dir="auto">The “in lines” part is a real key that <code>(?-s)</code> should be used.</p>
<p dir="auto">Otherwise, you could get a match like this (definitely unwanted):</p>
<p dir="auto"><img src="/assets/uploads/files/1643059187451-4011b833-cbb1-4cb8-837f-533cea84f352-image.png" alt="4011b833-cbb1-4cb8-837f-533cea84f352-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Note that I changed your data a bit in the above.</p>
<p dir="auto">See how there is a match on line 10 even though there is no <code>ingot</code> on line 10?  The ingot part starts on line 9… :</p>
<p dir="auto"><img src="/assets/uploads/files/1643059459243-e7e3961a-428a-41ac-a3fa-9d9b8feea192-image.png" alt="e7e3961a-428a-41ac-a3fa-9d9b8feea192-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Note that what I’m showing now is if you use <code>(?s)</code> instead of <code>(?-s)</code>.  The <code>-</code> turns off the ability to match line ending characters.</p>
<p dir="auto">So the <code>(?-s)</code> is a safety-valve on the expression, in this instance saying “everything must be on the same line”.</p>
<p dir="auto">Hopefully that makes a bit of sense.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73258</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73258</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 24 Jan 2022 21:25:16 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 21:13:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a><br />
Thanks a lot (again)!<br />
I understand everything except this line:</p>
<blockquote>
<p dir="auto"><code>(?-s)</code> : don’t let a following <code>.</code> match a line-ending</p>
</blockquote>
<p dir="auto">I can’t figure out what do you mean by that… Can you elaborate?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73257</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73257</guid><dc:creator><![CDATA[Zsombor Szarka]]></dc:creator><pubDate>Mon, 24 Jan 2022 21:13:18 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 16:27:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zsombor-szarka" aria-label="Profile: zsombor-szarka">@<bdi>zsombor-szarka</bdi></a></p>
<blockquote>
<p dir="auto">I started to learn about the search mechanism of notepad++, but it’s way too complex for me to figure it out. (i spent an hour learning it so far)</p>
</blockquote>
<p dir="auto">Well, any time invested in this endeavor is time well spent (for the NEXT time).</p>
<blockquote>
<p dir="auto">Can you give … explain it too?</p>
</blockquote>
<p dir="auto">I basically gave the syntax: <code>(?-s)ingot.*?=\Kfalse</code></p>
<p dir="auto">It means:</p>
<p dir="auto"><code>(?-s)</code> : don’t let a following <code>.</code> match a line-ending<br />
<code>ingot</code> : match the literal text<br />
<code>.*?</code> : match any characters zero or more times, minimally<br />
<code>=</code> : match literal equal<br />
<code>\K</code> : forget the match to this point (we don’t want to change <code>ingot</code> followed by whatever followed by <code>=</code>)<br />
<code>false</code> : match the literal text</p>
<p dir="auto">We replace with only <code>true</code> because the matched text will be <code>false</code> at this point.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73250</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73250</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 24 Jan 2022 16:27:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 16:02:15 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">No it worked perfectly, not almost.<br />
Just because you left something out of your problem statement doesn’t mean the solution provided was deficient.  :-)</p>
</blockquote>
<p dir="auto">Well i can’t argue with that, i should have formulated my sentences better.<br />
Anyway now it works as i wanted to, so thanks a lot!</p>
<p dir="auto">Have a wonderful day!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73249</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73249</guid><dc:creator><![CDATA[Zsombor Szarka]]></dc:creator><pubDate>Mon, 24 Jan 2022 16:02:15 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:47: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">Not a problem, Guy.<br />
Like I said maybe I shouldn’t have done it the way I did, because it really does look like that other construct.</p>
<p dir="auto">BTW, good to see you posting.<br />
You haven’t been very active lately.<br />
Hopefully you are “back” and will be posting on a more regular basis now.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73248</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73248</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:47:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:39:39 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/zsombor-szarka" aria-label="Profile: zsombor-szarka">@<bdi>zsombor-szarka</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">My bad ! <strong>Alan</strong>, I didn’t notice the <strong>equal</strong> sign in <strong>your</strong> version :-(</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73247</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73247</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:39:39 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:35:48 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> said in <a href="/post/73244">How to replace a specific text in lines that contains a specific word.</a>:</p>
<blockquote>
<p dir="auto">I may be wrong but I think that the correct search expression</p>
</blockquote>
<p dir="auto">I think the original is solution is fine.<br />
Perhaps the <code>?=</code> in it is confusing (looks maybe like a <code>(?=</code>…<code>)</code> construct?)<br />
But really it just forces <code>=false</code> to be matched.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73246</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73246</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:35:48 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:33:46 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> said in <a href="/post/73244">How to replace a specific text in lines that contains a specific word.</a>:</p>
<blockquote>
<p dir="auto">Indeed, the part _false, before the = sign, must not be changed !</p>
</blockquote>
<p dir="auto">That’s why Alan’s expression has the <code>.*?=</code> before the <code>\K</code>, to make sure everything before and including the equals is consumed without change</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73245</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73245</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:33:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:31:10 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/zsombor-szarka" aria-label="Profile: zsombor-szarka">@<bdi>zsombor-szarka</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I may be <strong>wrong</strong> but I think that the <strong>correct</strong> search expression is rather :</p>
<p dir="auto">SEARCH <strong><code>(?i-s):ingot.*\Kfalse$</code></strong></p>
<p dir="auto">Indeed, the part <strong><code>_false</code></strong>, before the <strong><code>=</code></strong> sign, must <strong>not</strong> be changed !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73244</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73244</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:31:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:25:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zsombor-szarka" aria-label="Profile: zsombor-szarka">@<bdi>zsombor-szarka</bdi></a> said in <a href="/post/73241">How to replace a specific text in lines that contains a specific word.</a>:</p>
<blockquote>
<p dir="auto">some lines, that contains “Ingot” (capital i) for some reason, and i would like to change them too.</p>
</blockquote>
<p dir="auto">Change the <code>(?-is)</code> part to <code>(?i-s)</code>.</p>
<p dir="auto">OR</p>
<p dir="auto">Make that part <code>(?-s)</code> and then use the <code>Match case</code> checkbox to do your will.</p>
<blockquote>
<p dir="auto">It did work almost perfectly.</p>
</blockquote>
<p dir="auto">No it worked perfectly, not almost.<br />
Just because you left something out of your problem statement doesn’t mean the solution provided was deficient.  :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73243</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73243</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:25:52 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:21:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> Thanks! It was a crazy fast reply!</p>
<p dir="auto">It did work almost perfectly. What i discovered, is that there are some lines, that contains “Ingot” (capital i) for some reason, and i would like to change them too. Can you modify your search so it will be independent from that factor? (of Course i can make two replaces with your syntax, i am just curious, what would be the solution for that)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73241</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73241</guid><dc:creator><![CDATA[Zsombor Szarka]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:21:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace a specific text in lines that contains a specific word. on Mon, 24 Jan 2022 15:15:04 GMT]]></title><description><![CDATA[<p dir="auto">You might try:</p>
<p dir="auto">find: <code>(?-is)ingot.*?=\Kfalse</code><br />
repl: <code>true</code><br />
mode: regular expression</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73237</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73237</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 24 Jan 2022 15:15:04 GMT</pubDate></item></channel></rss>