<?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[Blank Trim operations, on a text selection, ONLY]]></title><description><![CDATA[<p dir="auto">Hello <strong>Noitidart</strong> and <strong>All</strong>,</p>
<p dir="auto"><strong>Noitidart</strong>, I reply to your <strong>last</strong> post, on <strong>Github N++</strong> forums, at the address :</p>
<p dir="auto"><a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/302#issuecomment-115071964" rel="nofollow ugc">https://github.com/notepad-plus-plus/notepad-plus-plus/issues/302#issuecomment-115071964</a></p>
<p dir="auto">As I said before, the N++ <strong>Blank Trim</strong> Operations, logically, work on the <strong>totality</strong> of the current file. Luckily, it’s easy enough to use a search/replacement, in <strong>regular expression</strong> mode, to get rid of these blank characters, in a <strong>normal selection</strong>, ONLY.</p>
<p dir="auto">And, of course, you can store this <strong>specific</strong> search-replacement in a <strong>macro</strong>, which can be, easily, executed, further, from the <strong>macro</strong> Menu OR by hitting its <strong>associated</strong> shortcut !</p>
<p dir="auto">Let’s suppose you would like a macro to delete all <strong>trailing blanks</strong> in a <strong>selection</strong>. To do so :</p>
<ul>
<li>
<p dir="auto">Open any text file</p>
</li>
<li>
<p dir="auto">First, select some lines ( even <strong>without any</strong> trailing blank )</p>
</li>
<li>
<p dir="auto">Select the menu option <strong>Macro - Start recording</strong> OR the <strong>red circle</strong> button, on the <strong>Toolbar</strong></p>
</li>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog ( <strong>CTRL + H</strong> )</p>
</li>
<li>
<p dir="auto">In the <strong>Find what</strong> zone, type <code>\h+$</code></p>
</li>
<li>
<p dir="auto">Leave the <strong>Replace with</strong> zone <strong>empty</strong></p>
</li>
<li>
<p dir="auto">Check the <strong>In selection</strong> option</p>
</li>
<li>
<p dir="auto">Select the <strong>Regular expression</strong> search mode</p>
</li>
<li>
<p dir="auto">Click on the <strong>Replace All</strong> button</p>
</li>
<li>
<p dir="auto">Select the menu option <strong>Macro - Stop Recording</strong> Or the <strong>black square</strong> button, on the <strong>Toolbar</strong></p>
</li>
<li>
<p dir="auto">Open the menu option <strong>Macro - Save Currend recorded Macro…</strong></p>
</li>
<li>
<p dir="auto">Type, for instance, <strong>Trim SELECTION trailing BLANK characters</strong> as the current name for this macro</p>
</li>
<li>
<p dir="auto">Choose a <strong>shortcut</strong> for this macro ( Take care NOT to use an <strong>existing</strong> Notepad++ or plugin shortcut ! )</p>
</li>
<li>
<p dir="auto">Click on the <strong>OK</strong> button, to valid your choices</p>
</li>
</ul>
<p dir="auto">Now, each time you select a <strong>normal</strong> selection ( neither <strong>rectangular</strong> selection, nor <strong>multiple</strong> selections ), any trailing blank character will be <strong>removed</strong> of that selection, as soon as you choose the menu option <strong>Macro - Trim SELECTION trailing BLANK characters</strong> OR you use the its <strong>specific</strong> shorcut</p>
<p dir="auto">Without any <strong>previous normal</strong> selection, this macro doesn’t do anything. Nice isn’t it ?</p>
<p dir="auto">Best regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/77/blank-trim-operations-on-a-text-selection-only</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 14:13:35 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/77.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Jul 2015 13:04:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Blank Trim operations, on a text selection, ONLY on Mon, 01 Jan 2018 14:02:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/8834">@taa1</a></p>
<p dir="auto">Try this:</p>
<p dir="auto"><strong>Find what</strong> zone:  <code>(?-s)^\h*(.*?)\h*$</code><br />
<strong>Replace with</strong> zone:  <code>\1</code><br />
<strong>In selection</strong> checkbox:  <em><strong>ticked</strong></em><br />
<strong>Search mode</strong>:  <code>Regular expression</code><br />
Action:  Press <strong>Replace All</strong> button</p>
]]></description><link>https://community.notepad-plus-plus.org/post/29071</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/29071</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 01 Jan 2018 14:02:11 GMT</pubDate></item><item><title><![CDATA[Reply to Blank Trim operations, on a text selection, ONLY on Mon, 01 Jan 2018 06:36:33 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a>,</p>
<p dir="auto">If  <code>\h+$</code> removes trailing spaces, what regex would remove leading <em>and</em> trailing spaces? I’m looking for the equivalent of Edit -&gt; Blank Operations -&gt; Trim Leading and Trailing Space, but on selected text only.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/29065</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/29065</guid><dc:creator><![CDATA[taa1]]></dc:creator><pubDate>Mon, 01 Jan 2018 06:36:33 GMT</pubDate></item><item><title><![CDATA[Reply to Blank Trim operations, on a text selection, ONLY on Fri, 03 Mar 2017 15:20:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a></p>
<blockquote>
<p dir="auto">each time you select a normal selection ( neither rectangular selection, <strong>nor multiple selections</strong> )<br />
Without any previous normal selection, this macro doesn’t do anything</p>
</blockquote>
<p dir="auto">I recently had a need to record a replace macro that operated only upon selected text.  What I found was different from what <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> reported about multiple selections.  I found that if multiple selections are active when the macro is invoked, it <em>WILL</em> perform the replacement, but only in the selection created most recently (this is consistent with how Notepad++ performs this replacement interactively).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/22284</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/22284</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 03 Mar 2017 15:20:11 GMT</pubDate></item><item><title><![CDATA[Reply to Blank Trim operations, on a text selection, ONLY on Sun, 05 Jul 2015 05:19:56 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> for all that info this is real cool!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/210</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/210</guid><dc:creator><![CDATA[Noitidart]]></dc:creator><pubDate>Sun, 05 Jul 2015 05:19:56 GMT</pubDate></item><item><title><![CDATA[Reply to Blank Trim operations, on a text selection, ONLY on Sat, 04 Jul 2015 17:34:21 GMT]]></title><description><![CDATA[<p dir="auto">Hi <strong>Noitidart</strong>,</p>
<p dir="auto">I think that this <strong>N++ community</strong> is based on <strong>NodeBB forums</strong>. You’ll get further information, from the link below :</p>
<p dir="auto"><a href="https://nodebb.org/" rel="nofollow ugc">https://nodebb.org/</a></p>
<p dir="auto">See also the <strong>Don Ho</strong> post :</p>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/2/welcome-to-notepad-community" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/2/welcome-to-notepad-community</a></p>
<hr />
<p dir="auto">Secondly, you’ll find <strong>good documentation</strong>, about the new <strong>Boost C++ Regex library, v1.55.0</strong> ( similar to the <strong>PERL Regular Common Expressions, v1.48.0</strong> ), used by <strong>Notepad++</strong>, <em>since its <strong><code>6.0</code></strong> version</em>, at the <strong>TWO</strong> addresses below :</p>
<p dir="auto"><a href="http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html" rel="nofollow ugc">http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html</a></p>
<p dir="auto"><a href="http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html" rel="nofollow ugc">http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html</a></p>
<ul>
<li>
<p dir="auto">The <strong>FIRST</strong> link explains the <strong>syntax</strong>, of regular expressions, in the <strong>SEARCH</strong> part</p>
</li>
<li>
<p dir="auto">The <strong>SECOND</strong> link explains the <strong>syntax</strong>, of regular expressions, in the <strong>REPLACEMENT</strong> part</p>
</li>
</ul>
<p dir="auto">As for the <strong>\h</strong> regex syntax, just have a look to the paragraph <strong>“Single character” character classes</strong>, in the <strong>SEARCH</strong> document !</p>
<p dir="auto">Best regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/203</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/203</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 04 Jul 2015 17:34:21 GMT</pubDate></item><item><title><![CDATA[Reply to Blank Trim operations, on a text selection, ONLY on Sat, 04 Jul 2015 16:11:12 GMT]]></title><description><![CDATA[<p dir="auto">Oh wow I didn’t know we could save things as a macro! Thanks very very much for this detailed instructions Im going to follow it right away!</p>
<p dir="auto">And this new community is absolutely beautiful! Is it public software or custom?</p>
<p dir="auto">edit: just tested it and it works so awesome! thank you!</p>
<p dir="auto">btw what language uses <code>\h</code> i can’t find that symbol in any regex tutorials, what is it btw?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/200</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/200</guid><dc:creator><![CDATA[Noitidart]]></dc:creator><pubDate>Sat, 04 Jul 2015 16:11:12 GMT</pubDate></item></channel></rss>