<?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[Regex to increase or decrease last digit in line by one.]]></title><description><![CDATA[<p dir="auto">So I want to know if there is a regex to increase or decrease the value of the last digit in a line by one.<br />
Example:</p>
<p dir="auto">Reg1ex234 &gt;&gt;&gt;&gt; Reg1ex235</p>
<p dir="auto">I’ve seen several examples to change ALL the digits in a line, but not the last one. Is this possible by regex only?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18695/regex-to-increase-or-decrease-last-digit-in-line-by-one</link><generator>RSS for Node</generator><lastBuildDate>Fri, 07 Aug 2026 12:59:43 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18695.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Jan 2020 12:49:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regex to increase or decrease last digit in line by one. on Mon, 13 Jan 2020 23:58:46 GMT]]></title><description><![CDATA[<p dir="auto">I should add that it works for this reason:</p>
<h2>.+ :</h2>
<p dir="auto"><code>.+</code> matches (one or more characters) as much as it can before moving on.  Also known as the “maximum munch”. So given the pattern <code>.+\d</code> and the string-to-test as <code>abc123def345</code> the <code>.+</code> part would match <code>abc123def34</code> because the ending <code>5</code> would satisfy the <code>\d</code> in the pattern.</p>
<h2>.+? :</h2>
<p dir="auto"><code>.+?</code> matches (one or more characters) as little as possible before moving on.  Also known as the “minimum munch”. With the pattern <code>.+?\d</code> and the same string-to-test, the <code>.+?</code> part would match <code>abc</code> because the following <code>1</code> would match the <code>\d</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49849</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49849</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 13 Jan 2020 23:58:46 GMT</pubDate></item><item><title><![CDATA[Reply to Regex to increase or decrease last digit in line by one. on Mon, 13 Jan 2020 17:51:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/reggy-guy" aria-label="Profile: Reggy-guy">@<bdi>Reggy-guy</bdi></a> said:</p>
<blockquote>
<p dir="auto">the regex to do this to the first number in every line instead of last</p>
</blockquote>
<p dir="auto">Deceptively simple, I think.</p>
<p dir="auto">Just add a <code>?</code> after the <code>+</code> in the earlier search expression.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49836</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49836</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 13 Jan 2020 17:51:37 GMT</pubDate></item><item><title><![CDATA[Reply to Regex to increase or decrease last digit in line by one. on Mon, 13 Jan 2020 12:37:16 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> Hello again, could you help me with the regex to do this to the first number in every line instead of last?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49828</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49828</guid><dc:creator><![CDATA[Reggy guy]]></dc:creator><pubDate>Mon, 13 Jan 2020 12:37:16 GMT</pubDate></item><item><title><![CDATA[Reply to Regex to increase or decrease last digit in line by one. on Thu, 02 Jan 2020 14:33:54 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> . It will be enough to resolve my current problem :).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49550</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49550</guid><dc:creator><![CDATA[Reggy guy]]></dc:creator><pubDate>Thu, 02 Jan 2020 14:33:54 GMT</pubDate></item><item><title><![CDATA[Reply to Regex to increase or decrease last digit in line by one. on Thu, 02 Jan 2020 13:14:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/reggy-guy" aria-label="Profile: Reggy-guy">@<bdi>Reggy-guy</bdi></a></p>
<p dir="auto">If your intent is to only ever affect the last digit, then yes, perfectly possible.  But…most people would expect a change of this sort to transform <code>2019</code> into <code>2020</code> (note that <em>TWO</em> digits changed!) and this is not a reasonable expectation from regex replacement.</p>
<p dir="auto">However, if that’s acceptable, then a way to change the only the last digit appearing on a line to the next digit <em>lower</em> is to search for <code>(?-s)^(.+)(?:(0)|(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9))</code> and replace with <code>\1(?{2}9)(?{3}0)(?{4}1)(?{5}2)(?{6}3)(?{7}4)(?{8}5)(?{9}6)(?{10}7)(?{11}8)</code></p>
<p dir="auto">That borrows heavily from the other post you linked to. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49548</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49548</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 02 Jan 2020 13:14:09 GMT</pubDate></item><item><title><![CDATA[Reply to Regex to increase or decrease last digit in line by one. on Thu, 02 Jan 2020 12:51:50 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> I saw your reply <a href="https://community.notepad-plus-plus.org/topic/14884/regex-to-change-numbers-to-a-value-1-step-lower/2">https://community.notepad-plus-plus.org/topic/14884/regex-to-change-numbers-to-a-value-1-step-lower/2</a></p>
<p dir="auto">Is this possible only for the last digit in the line via regex? Thank you!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49546</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49546</guid><dc:creator><![CDATA[Reggy guy]]></dc:creator><pubDate>Thu, 02 Jan 2020 12:51:50 GMT</pubDate></item></channel></rss>