<?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 turn a 4 digits sequence into string and and get 5 digits sequence instead ?]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I have a list of zip codes (~38000) and some of them are malformed.</p>
<p dir="auto">How could i detect in a list if a zip code has only 4 digits instead of 5 , if so i would like to add 0 at the head of it to get 5 digits at the end.</p>
<p dir="auto">ie , the first 3 zip codes of that list are correct, the last is not ( only 4 digits )</p>
<p dir="auto">10800 VILLEMEREUIL	<br />
10800 VILLY-LE-BOIS	<br />
10800 VILLY-LE-MARECHAL	<br />
1090 FRANCHELEINS</p>
<p dir="auto">How could i turn “1090 FRANCHELEINS” to “01090 FRANCHELEINS” ?</p>
<p dir="auto">I was thinking about checking if the 5th character is a ‘space’ if not add ‘0’ at the end of the string.</p>
<p dir="auto">Many thanks for your support,</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/15233/how-to-turn-a-4-digits-sequence-into-string-and-and-get-5-digits-sequence-instead</link><generator>RSS for Node</generator><lastBuildDate>Tue, 19 May 2026 21:40:32 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/15233.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 08 Feb 2018 21:34:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to turn a 4 digits sequence into string and and get 5 digits sequence instead ? on Fri, 09 Feb 2018 14:26:35 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/laurent-coulon" aria-label="Profile: laurent-coulon">@<bdi>laurent-coulon</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">Even more simple :</p>
<p dir="auto">SEARCH <strong><code>\b\d{4}\b</code></strong> OR  <strong><code>\&lt;\d{4}\&gt;</code></strong></p>
<p dir="auto">REPLACE <strong><code>0$0</code></strong></p>
<p dir="auto">Just use the <strong><code>$0</code></strong> syntax, in replacement, which <strong>always</strong> represents the <strong>entire match</strong>. So, it avoids to add <strong>parentheses</strong> in order to store the match at <strong>group 1</strong> :-)</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30152</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30152</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 09 Feb 2018 14:26:35 GMT</pubDate></item><item><title><![CDATA[Reply to How to turn a 4 digits sequence into string and and get 5 digits sequence instead ? on Fri, 09 Feb 2018 06:19:34 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much Peter.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30150</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30150</guid><dc:creator><![CDATA[Laurent Coulon]]></dc:creator><pubDate>Fri, 09 Feb 2018 06:19:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to turn a 4 digits sequence into string and and get 5 digits sequence instead ? on Thu, 08 Feb 2018 23:11:11 GMT]]></title><description><![CDATA[<p dir="auto">Just remove the <code>\x20</code> from the end of both.  <code>\b</code> matches the boundary between <code>.</code> and a number as well.<br />
This version will replace any 4-digit number with a 5-digit number.</p>
<p dir="auto">Find What: <code>\b(\d{4})\b</code><br />
Replace: <code>0$1</code></p>
<p dir="auto">Note that <code>\b</code> will find lots of boundaries: start of line, end of line, start of word (ie, transition from punctuation or space to alphanumeric), end of word (ie, transition from alphanumeric to punctuation or space).  So it should work wherever your zip code lies.</p>
<p dir="auto">Note that <code>_</code> counts as alphanumeric, not punctuation, so this regex would not match <code>BRESSE_1000</code>, though it does match <code>BRESSE.1000</code>.  Also, <code>\b</code> does not match the boundary between letters and numbers, so it will not match <code>BRESSE1000</code> or <code>1000BRESSE</code>.  Using lookaheads or lookbehinds, those would be doable, too…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30149</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30149</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 08 Feb 2018 23:11:11 GMT</pubDate></item><item><title><![CDATA[Reply to How to turn a 4 digits sequence into string and and get 5 digits sequence instead ? on Thu, 08 Feb 2018 22:43:59 GMT]]></title><description><![CDATA[<p dir="auto">Many thanks, it works perfectly.</p>
<p dir="auto">If the list starts differently, as follow :<br />
( zip codes placed at the end of the string ,  all zip codes start after “.” character )</p>
<p dir="auto">BOURGEAUVILLE.14430<br />
BOURG-EN-BRESSE.1000<br />
BOURGES.18000<br />
BOURG-ET-COMIN.2160</p>
<p dir="auto">How could i turn 4 digits ones to 5 digits, starting with 0xxxx ?<br />
In that case “.” has not a defined place due to city name length variation…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30147</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30147</guid><dc:creator><![CDATA[Laurent Coulon]]></dc:creator><pubDate>Thu, 08 Feb 2018 22:43:59 GMT</pubDate></item><item><title><![CDATA[Reply to How to turn a 4 digits sequence into string and and get 5 digits sequence instead ? on Thu, 08 Feb 2018 22:13:00 GMT]]></title><description><![CDATA[<p dir="auto">Find What: <code>\b(\d{4})\b\x20</code><br />
Replace: <code>0$1\x20</code></p>
<ul>
<li><code>\b</code> = boundary – means a transition from something to word/number or word/number to something (0-width; doesn’t consume a character in the string)</li>
<li><code>()</code> = capture whatever’s inside</li>
<li><code>\d{4}</code> = exactly four digits</li>
<li><code>\x20</code> = space character</li>
<li><code>$1</code> = the first captured <code>()</code></li>
</ul>
<p dir="auto">Thus, it will look for “boundary / 4 digits / boundary / space”, and replace it with "0 / original 4 digits / space`</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30145</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30145</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 08 Feb 2018 22:13:00 GMT</pubDate></item></channel></rss>