<?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[Find and Replace characters in a column range using Regex]]></title><description><![CDATA[<p dir="auto">I need to check columns 50 thru 55 for a - and if found replace with a .  My file has 1M lines.</p>
<p dir="auto">I have figured out how to start it for column 50 but how do i repeat this for the next 4 columns.</p>
<p dir="auto">Find what: ^.{49}\K-<br />
Replace with: .</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18414/find-and-replace-characters-in-a-column-range-using-regex</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 01:09:47 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18414.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Oct 2019 22:49:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find and Replace characters in a column range using Regex on Sat, 26 Oct 2019 18:01:41 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/bob-johnson" aria-label="Profile: bob-johnson">@<bdi>bob-johnson</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">OK, <strong>Bob</strong>. Luckily your S/R does <strong>not</strong> change the columns <strong>order</strong>, as you just want to replace <strong><code>1</code></strong> char with a <strong>single</strong> char, too. So, given the <strong>sample</strong> text below :</p>
<pre><code class="language-diff">                                                 Column
                                               4455555555
                                               8901234567
0       ABCDE                     VWXYZ        -                12345    # - at column 48
0       ABCDE                     VWXYZ         -               12345    # - at column 49

0       ABCDE                     VWXYZ          -BCDEFG        12345    # - at column 50
0       ABCDE                     VWXYZ          A-CDEFG        12345    # - at column 51
0       ABCDE                     VWXYZ          AB-DEFG        12345    # - at column 52
0       ABCDE                     VWXYZ          ABC-EFG        12345    # - at column 53
0       ABCDE                     VWXYZ          ABCD-FG        12345    # - at column 54
0       ABCDE                     VWXYZ          ABCDE-G        12345    # - at column 55

0       ABCDE                     VWXYZ                -        12345    # - at column 56
0       ABCDE                     VWXYZ                 -       12345    # - at column 57
</code></pre>
<p dir="auto">The following <strong>regex</strong> S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^.{49}.{0,5}\K-</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>.</code></strong></p>
</li>
<li>
<p dir="auto">Tick the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
<li>
<p dir="auto">And choose, of course, the <strong><code>Regular expression</code></strong> search mode</p>
</li>
</ul>
<p dir="auto">It should modify the text, as <strong>expected</strong> :</p>
<pre><code class="language-diff">                                                 Column
                                               4455555555
                                               8901234567
0       ABCDE                     VWXYZ        -                12345    # - at column 48
0       ABCDE                     VWXYZ         -               12345    # - at column 49

0       ABCDE                     VWXYZ          .BCDEFG        12345    # - at column 50
0       ABCDE                     VWXYZ          A.CDEFG        12345    # - at column 51
0       ABCDE                     VWXYZ          AB.DEFG        12345    # - at column 52
0       ABCDE                     VWXYZ          ABC.EFG        12345    # - at column 53
0       ABCDE                     VWXYZ          ABCD.FG        12345    # - at column 54
0       ABCDE                     VWXYZ          ABCDE.G        12345    # - at column 55

0       ABCDE                     VWXYZ                -        12345    # - at column 56
0       ABCDE                     VWXYZ                 -       12345    # - at column 57
</code></pre>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The first part <strong><code>(?-s)</code></strong> forces the regex engine to consider that <strong>dot</strong> ( <strong><code>.</code></strong> ) represents a <strong>single standard</strong> char only ( Not an <strong>EOL</strong> one )</p>
</li>
<li>
<p dir="auto">The special syntax <strong><code>\K</code></strong>, <strong>cancels</strong> any <strong>previous</strong> search, already <strong>matched</strong>, at <strong>current</strong> location of the regex <strong>engine</strong> and, in your case, just consider the <strong>last</strong> <strong><code>-</code></strong> character</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/48059</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/48059</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 26 Oct 2019 18:01:41 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Replace characters in a column range using Regex on Sat, 26 Oct 2019 02:41:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bob-johnson" aria-label="Profile: Bob-Johnson">@<bdi>Bob-Johnson</bdi></a> said in <a href="/post/48051">Find and Replace characters in a column range using Regex</a>:</p>
<blockquote>
<p dir="auto">how do i repeat this for the next 4 columns</p>
</blockquote>
<p dir="auto">The simplest way would be to use your original regex, but change the 49 to 50, then 51 etc. So in effect you run the regex 5 times in total, increasing the number by 1 each time.</p>
<p dir="auto">It is possible to create another regex to cater for 1,2,3,4 or 5 - in a row that only needs running once, but I don’t think it’s worth the effort, especially if what you are editing is not a regular occurrence.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/48052</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/48052</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sat, 26 Oct 2019 02:41:13 GMT</pubDate></item></channel></rss>