<?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[Search and replace with increasing interger]]></title><description><![CDATA[<p dir="auto">In a script I’m working on, I account for unexpected outcomes with a line:</p>
<p dir="auto"><code>panicExit "1" "Some error message goes here"</code></p>
<p dir="auto">Where <code>panicExit</code> is the exit function, <code>"1"</code> is the error code, and <code>"Some error message goes here"</code> is the error message.</p>
<p dir="auto">Over the length of this script, as I’m writing my logic statements, I end up with a lot of these <code>panicExit</code> lines. They are always the only thing in whatever line number they are found on, but they may have any number of leading spaces or tabs. What I would like to do is search/iterate through every line of the file, and if we find the pattern:</p>
<p dir="auto"><code>panicExit "[[:digit:]]+" ".*"</code></p>
<p dir="auto">Replace that <code>[[:digit:]]+</code> with an auto-increasing number. So the first instance of <code>panicExit</code> will have an error code of <code>1</code>, the second of <code>2</code>, and so on.</p>
<p dir="auto">I’m not sure if the built-in “Macro” function is capable of this or not. I’d appreciate any direction on the best way to accomplish this. Thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/25952/search-and-replace-with-increasing-interger</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 07:47:31 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/25952.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 Jul 2024 16:15:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Search and replace with increasing interger on Wed, 17 Jul 2024 16:39:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/coises" aria-label="Profile: Coises">@<bdi>Coises</bdi></a> ,</p>
<p dir="auto">Fixed.  In the future, you could just chat-message the FAQ author (in this case, me).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/95812</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/95812</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 17 Jul 2024 16:39:30 GMT</pubDate></item><item><title><![CDATA[Reply to Search and replace with increasing interger on Wed, 17 Jul 2024 16:30:53 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/95808">Search and replace with increasing interger</a>:</p>
<blockquote>
<p dir="auto">Columns++ plugin […] <a href="https://community.notepad-plus-plus.org/topic/23170/faq-can-i-do-a-mathematical-replacement/3#:~:text=L010%2D%2C%20L015%2D%2C%20etc.-,REPLACE%20WITH%20A%20SIMPLE%20COUNTER%20(I.E.%2C%20RENUMBERING),-To%20change%3A">in our Mathematical Replacement FAQ</a></p>
</blockquote>
<p dir="auto">I’m not sure where FAQ corrections should go, but I just noticed the FAQ says Columns++ is not available through Plugins Admin, which is no longer true.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/95811</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/95811</guid><dc:creator><![CDATA[Coises]]></dc:creator><pubDate>Wed, 17 Jul 2024 16:30:53 GMT</pubDate></item><item><title><![CDATA[Reply to Search and replace with increasing interger on Wed, 17 Jul 2024 16:22:52 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the quick reply and suggestion! I don’t have enough rep to upvote, so please accept this response as gratitude instead. Appreciate your time!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/95810</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/95810</guid><dc:creator><![CDATA[goose-ws]]></dc:creator><pubDate>Wed, 17 Jul 2024 16:22:52 GMT</pubDate></item><item><title><![CDATA[Reply to Search and replace with increasing interger on Wed, 17 Jul 2024 16:20:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/goose-ws" aria-label="Profile: goose-ws">@<bdi>goose-ws</bdi></a> ,</p>
<p dir="auto">Sounds like a job for the Columns++ plugin – the “replace with a counter” example is shown <a href="https://community.notepad-plus-plus.org/topic/23170/faq-can-i-do-a-mathematical-replacement/3#:~:text=L010%2D%2C%20L015%2D%2C%20etc.-,REPLACE%20WITH%20A%20SIMPLE%20COUNTER%20(I.E.%2C%20RENUMBERING),-To%20change%3A">in our Mathematical Replacement FAQ</a>  (in an earlier section of the FAQ, it explains how to do the same thing in PythonScript plugin; or you can use the <code>CNT</code> variable in the Multi Replace plugin, described later in the FAQ)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/95808</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/95808</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 17 Jul 2024 16:20:54 GMT</pubDate></item></channel></rss>