<?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[move everything on a line after the occurrance of a string to a fixed column]]></title><description><![CDATA[<p dir="auto">Hi, I have no doubt this has been asked before, but I cant find the question…<br />
I have a file, ( 4000+ entries )</p>
<pre><code> QUALIFIEDMORTGAGECODE QUALIFIED MORTGAGE CODE
 PURCHASEPRICE PURCHASE PRICE
 PROPERTYVALUEAMOUNT PROPERTY VALUE AMOUNT
 PROPERTYTYPE PROPERTY TYPE
</code></pre>
<p dir="auto">In which I want everything after the first space to start in column 32, using spaces, not tabs</p>
<pre><code> QUALIFIEDMORTGAGECODE            QUALIFIED MORTGAGE CODE
 PURCHASEPRICE                    PURCHASE PRICE
 PROPERTYVALUEAMOUNT              PROPERTY VALUE AMOUNT
 PROPERTYTYPE                     PROPERTY TYPE
</code></pre>
<p dir="auto">What regex expression should I using to achieve this goal?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19541/move-everything-on-a-line-after-the-occurrance-of-a-string-to-a-fixed-column</link><generator>RSS for Node</generator><lastBuildDate>Tue, 16 Jun 2026 15:36:06 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19541.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Jun 2020 20:24:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to move everything on a line after the occurrance of a string to a fixed column on Thu, 11 Jun 2020 19:02:46 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-bouttell" aria-label="Profile: Anthony-Bouttell">@<bdi>Anthony-Bouttell</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>, All:</p>
<p dir="auto">For the sake of variety, look at this non-regex solution (it only requires the <code>BetterMultiSelection</code> and <code>Elastic Tabstops</code> plugins installed and enabled, which you can download and install via <code>Plugins Admin</code>):</p>
<p dir="auto"><img src="https://camo.nodebb.org/0286f4758a545ac5ab55d3a7050da673133072fd?url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FQvksFaulm9ejxjzVNx%2Fgiphy.gif" alt="Giphy" class=" img-fluid img-markdown" /></p>
<p dir="auto">First off, open <code>Preferences -&gt; Editing</code>, and enable the <code>Multi-Editing Settings</code>.</p>
<p dir="auto">Then, do as the movie shows:</p>
<ol>
<li>
<p dir="auto">Go to the first line and insert the required spaces to move the second word up to column 32.</p>
</li>
<li>
<p dir="auto">Press <code>Home</code> to place the caret at the beginning of this line.</p>
</li>
<li>
<p dir="auto">Press <code>Shift + Alt</code> and move the caret from the top line until the bottom of the list with the <code>arrow down</code> - you will get a giant caret blinking along 8 lines with no characters selected.</p>
</li>
<li>
<p dir="auto">Press <code>Ctrl + Right</code> twice. Eight carets will be blinking at the left of each second word.</p>
</li>
<li>
<p dir="auto">Press <code>Shift + Left</code> to backward select a space.</p>
</li>
<li>
<p dir="auto">Press <code>Tab</code> to <em>magically</em> align all the second words.</p>
</li>
<li>
<p dir="auto">Press <code>Esc</code> and then <code>Down</code> to release the multiselection.</p>
</li>
<li>
<p dir="auto">Select <code>Plugins -&gt; Elastic Tabstops -&gt; Convert Tabstops to Spaces</code>.</p>
</li>
</ol>
<p dir="auto">That’s all. Hope you like it.</p>
<p dir="auto">Have fun!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54925</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54925</guid><dc:creator><![CDATA[astrosofista]]></dc:creator><pubDate>Thu, 11 Jun 2020 19:02:46 GMT</pubDate></item><item><title><![CDATA[Reply to move everything on a line after the occurrance of a string to a fixed column on Fri, 12 Jun 2020 11:02:47 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-bouttell" aria-label="Profile: anthony-bouttell">@<bdi>anthony-bouttell</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">Like <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, here is an other <strong>two-steps</strong> method. But:</p>
<ul>
<li>
<p dir="auto">As it seems that each line of your text begins with a <strong>space</strong> char, I slightly change the <strong>first</strong> search regex</p>
</li>
<li>
<p dir="auto">In the <strong>second</strong> search regex, we skip the <strong>first <code>31</code></strong> characters of <strong>each</strong> line, then we grasp any <strong>non-null</strong> range of <strong>space</strong> chars</p>
</li>
</ul>
<p dir="auto">So, assuming your <strong>initial</strong> text :</p>
<pre><code class="language-diff"> QUALIFIEDMORTGAGECODE QUALIFIED MORTGAGE CODE
 PURCHASEPRICE PURCHASE PRICE
 PROPERTYVALUEAMOUNT PROPERTY VALUE AMOUNT
 PROPERTYTYPE PROPERTY TYPE
</code></pre>
<p dir="auto">This <strong>regex</strong> S/R :</p>
<p dir="auto">SEARCH <strong><code>(?&lt;=\w)\x20.+</code></strong></p>
<p dir="auto">REPLACE <strong><code>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20$0</code></strong></p>
<p dir="auto">In <strong>replacement</strong>, note the <strong><code>$0</code></strong> syntax, after the <strong><code>30</code></strong> <strong>consecutive space</strong> chars ( <strong><code>\x20</code></strong> )</p>
<p dir="auto">gives :</p>
<pre><code class="language-diff"> QUALIFIEDMORTGAGECODE                               QUALIFIED MORTGAGE CODE
 PURCHASEPRICE                               PURCHASE PRICE
 PROPERTYVALUEAMOUNT                               PROPERTY VALUE AMOUNT
 PROPERTYTYPE                               PROPERTY TYPE
</code></pre>
<p dir="auto">And with this second <strong>regex</strong> S/R</p>
<p dir="auto">SEARCH <strong><code>^.{31}\K\x20+</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">You should get the <strong>expected</strong> data :</p>
<pre><code class="language-diff"> QUALIFIEDMORTGAGECODE         QUALIFIED MORTGAGE CODE
 PURCHASEPRICE                 PURCHASE PRICE
 PROPERTYVALUEAMOUNT           PROPERTY VALUE AMOUNT
 PROPERTYTYPE                  PROPERTY TYPE
</code></pre>
<p dir="auto">IMPORTANT :</p>
<ul>
<li>
<p dir="auto">Due to the <strong>presence</strong> of the <strong><code>(?&lt;=\w)</code> look-behind</strong> syntax and the <strong><code>\K</code></strong> syntax, you <strong>must</strong> use the <strong><code>Replace All</code></strong> button, <strong>exclusively</strong>, for these <strong>two</strong> S/R !</p>
</li>
<li>
<p dir="auto">If you need to perform these <strong>two</strong> regex S/R on a part of your text, <strong>only</strong>, in order to <strong>restrict</strong> the scope of the <strong><code>Replace All</code></strong> button, simply do a <strong>selection</strong> of the range of text, involved in the S/R, and <strong>tick</strong> the <strong><code>In selection</code></strong> option !</p>
</li>
<li>
<p dir="auto">In order that the <strong>second</strong> regex S/R <strong>correctly</strong> works, a <strong>fair</strong> amount of spaces characters <strong>must</strong> fill up each line. When in <strong>doubt</strong>, just perform, again, the <strong>first</strong> regex S/R, to add <strong><code>30</code></strong> <strong>spaces</strong>, again, <strong>before</strong> running the <strong>second</strong> S/R</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54923</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54923</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 12 Jun 2020 11:02:47 GMT</pubDate></item><item><title><![CDATA[Reply to move everything on a line after the occurrance of a string to a fixed column on Wed, 10 Jun 2020 22:12:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-bouttell" aria-label="Profile: Anthony-Bouttell">@<bdi>Anthony-Bouttell</bdi></a>,</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thanks!! It worked like a charm.</p>
</blockquote>
<p dir="auto">Glad it works for you.</p>
<blockquote>
<p dir="auto">I notice you use <strong>${1}</strong></p>
</blockquote>
<p dir="auto">I learned regex in Perl, where the <code>\1</code> notation has been deprecated in favor of <code>$1</code> or <code>${1}</code> for quite some time.  It’s what I’m used to.  And by using the braces, it always disambiguates between <code>${1}0</code> and <code>${10}</code>, whereas <code>$10</code> or <code>\10</code> always means the former, but looks an awful lot like it means the latter.  But it’s just a stylistic choice; they all work.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54894</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54894</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 10 Jun 2020 22:12:33 GMT</pubDate></item><item><title><![CDATA[Reply to move everything on a line after the occurrance of a string to a fixed column on Wed, 10 Jun 2020 21:43:26 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> Thanks!! It worked like a charm.</p>
<p dir="auto">I notice you use <strong>${1}</strong><br />
I generally use <strong>\1</strong><br />
is <strong>${1}</strong> the preferred method for labels now?</p>
<p dir="auto">FYI… The number 32 was just a guess, based on a small sample. Given some of the tags I just saw, it’ll be around 60.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54893</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54893</guid><dc:creator><![CDATA[Anthony Bouttell]]></dc:creator><pubDate>Wed, 10 Jun 2020 21:43:26 GMT</pubDate></item><item><title><![CDATA[Reply to move everything on a line after the occurrance of a string to a fixed column on Wed, 10 Jun 2020 20:45:25 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">I would call your example text having the second word start in column 34</p>
</blockquote>
<p dir="auto">Based on that same definition, I would actually call my result “start in 33” rather than “start in 32”.</p>
<p dir="auto">Yours would’ve been “start in 33” in a 0-based, which is what would be required for mine to be “start in 32”.</p>
<blockquote>
<p dir="auto">This should give you a starting point. If it doesn’t work, explain how it was wrong (including numerical rulers, if necessary)</p>
</blockquote>
<p dir="auto">I apparently never finished that thought.  I meant to go on and say:</p>
<blockquote>
<p dir="auto">But before asking us for more help, try to tweak what I gave you to get closer to your goal.  If you try, but still cannot get it quite right, show us what you tried, and we can help you tweak it more.</p>
</blockquote>
]]></description><link>https://community.notepad-plus-plus.org/post/54890</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54890</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 10 Jun 2020 20:45:25 GMT</pubDate></item><item><title><![CDATA[Reply to move everything on a line after the occurrance of a string to a fixed column on Wed, 10 Jun 2020 20:42:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-bouttell" aria-label="Profile: Anthony-Bouttell">@<bdi>Anthony-Bouttell</bdi></a>,</p>
<p dir="auto">Personally(*), I would accomplish this task in two steps: first, make sure everything has at least 32 spaces after the first word; second, reduce those so that there are only 32 characters in the left section.</p>
<ol>
<li>
<p dir="auto">make sure everything has at least 32 spaces after the first word</p>
<ul>
<li>FIND = <code>(?-s)^(.*?)\x20</code></li>
<li>REPLACE = <code>${1}\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</code> (that’s 32 of the <code>\x20</code> character to encode a space</li>
<li>Search Mode = regular expression</li>
</ul>
</li>
<li>
<p dir="auto">reduce those so that there are only 32 characters in the left section</p>
<ul>
<li>FIND = <code>(?-s)^(.{32})\x20*</code></li>
<li>REPLACE = <code>${1}</code></li>
<li>Search Mode = regular expression</li>
</ul>
</li>
</ol>
<p dir="auto">Based on your definition of “start in column 32”, I may be off by 1-2 chars in where the final placement is; change the <code>{32}</code> by +/- 1-2 if it’s note quite right; you might also want a few extra <code>\x20</code> in the first replacement</p>
<p dir="auto">I gave that caveat because I would call your example text having the second word start in column 34:</p>
<pre><code>123456789x123456789x123456789x123456789x
QUALIFIEDMORTGAGECODE            QUALIFIED MORTGAGE CODE
PURCHASEPRICE                    PURCHASE PRICE
PROPERTYVALUEAMOUNT              PROPERTY VALUE AMOUNT
PROPERTYTYPE                     PROPERTY TYPE
</code></pre>
<p dir="auto">If that space at the beginning was real, then we might need to tweak that first expression to ignore a space in the first column.</p>
<pre><code>123456789x123456789x123456789x123456789x
 QUALIFIEDMORTGAGECODE            QUALIFIED MORTGAGE CODE
 PURCHASEPRICE                    PURCHASE PRICE
 PROPERTYVALUEAMOUNT              PROPERTY VALUE AMOUNT
 PROPERTYTYPE                     PROPERTY TYPE
</code></pre>
<p dir="auto">This should give you a starting point.  If it doesn’t work, explain how it was wrong (including numerical rulers, if necessary)</p>
<p dir="auto">*: some would craft a single regex to do it.  I have been known to try that, even in this forum.  But really, for practical regex, it’s best to stick with what’s logical and most efficient – and with what you can easily think of and understand.  It’s usually more efficient to do something like this in multiple steps, because the time spent in crafting a super-fancy regex might make it more fragile (less able to handle slight changes) than step-by-step ones.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54889</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54889</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 10 Jun 2020 20:42:07 GMT</pubDate></item></channel></rss>