<?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[Efficiently select&#x2F;copy bookmarked lines and their collapsed contents altogether?]]></title><description><![CDATA[<p dir="auto">I have bunch of sections and collapsed contents (ie. .ini format) shown.<br />
<img src="/assets/uploads/files/1739915315997-603c5471-285f-4421-9f85-0ae764005a68-image.png" alt="603c5471-285f-4421-9f85-0ae764005a68-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I’ve identified the keyword of interest (ie. “positive” in this case) by Bookmark line" &amp; “Mark All”) and would like to select/copy both the bookmarked lines and their content collapsed in the bookmarked lines (ie. line 1-3, 4-6, 10-12).</p>
<p dir="auto"><img src="/assets/uploads/files/1739915206733-915dd84f-b0ad-412b-b0f1-c2d7208efeed-image.png" alt="915dd84f-b0ad-412b-b0f1-c2d7208efeed-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><strong>How can I select/copy both bookmarked and collapsed lines within more efficiently, without actually unfolding, for example, the section 1 to select line 2-3?</strong></p>
<p dir="auto">I’ve hovered Ctrl + mouse manually from the beginning of the bookmarker lines of interest for line selection. Can Notepad++ select/copy the lines in the bookmarked/collapsed easily?</p>
<p dir="auto">Thanks for comments.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26638/efficiently-select-copy-bookmarked-lines-and-their-collapsed-contents-altogether</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 06:57:26 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26638.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Feb 2025 22:21:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Efficiently select&#x2F;copy bookmarked lines and their collapsed contents altogether? on Sat, 22 Feb 2025 02:50:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fermi" aria-label="Profile: Fermi">@<bdi>Fermi</bdi></a> said in <a href="/post/99948">Efficiently select/copy bookmarked lines and their collapsed contents altogether?</a>:</p>
<blockquote>
<p dir="auto">In a generic form (.ini), I want to select the header and its contents, where the header/comment before/after the keyword (ie. positive) are unique.</p>
</blockquote>
<p dir="auto">Ideally, regular expressions are constructed to match <strong>only</strong> the data you want it to match and will <strong>not</strong> match anything else. You don’t want false positives nor false negatives.</p>
<p dir="auto">As you seem unwilling or unable to provide examples of the data you are attempting to match any help we provide here will also need to be generic or vague. To complicate things, you also seem to be shifting the goalposts of what a section header looks like.</p>
<p dir="auto">I decided to define a section header as a line that starts with a <code>[</code> and that anything else is not a section header line. With that in mind, here is a rather general regular expression that will match the <code>positive</code> sections:</p>
<pre><code class="language-txt">(?-i)^\[.*[,;] *positive,.*\R(?:(?!\[).*\R)*
</code></pre>
<p dir="auto">That expression has two main parts</p>
<ul>
<li><code>(?-i)^\[.*[,;] *positive,.*\R</code> matches the section header lines we are interested in.</li>
<li><code>(?:(?!\[).*\R)*</code> matches zero or more lines that are <strong>not</strong> section header lines.</li>
</ul>
<p dir="auto">Reading the <code>(?-i)^\[.*[,;] *positive,.*\R</code> part from left to right we have:</p>
<ul>
<li><code>(?-i)</code> Turns off the ignore-case option so that we only match a lower case <code>positive</code>. If your data includes things such as <code>Positive</code> or <code>POSITIVE</code> then you should use <code>(?i)</code> instead of <code>(?-i)</code>.</li>
<li><code>^</code> matches the start of a line,</li>
<li><code>\[</code> matches a <code>[</code>. We need the <code>\</code> as <code>[</code>s have a special meaning within regular expressions. Using <code>\[</code> says to look for a normal <code>[</code>.</li>
<li><code>.*</code> matches zero to any number of characters.</li>
<li><code>[,;]</code> matches either a comma or semicolon. When you first posted you had commas and now you have semicolons. That’s fine, we can handle either or both and so I went with both.</li>
<li><code> *</code> matches zero to any number of spaces between the <code>[,;]</code> and the <code>positive</code>.</li>
<li><code>positive,</code> matches the word <code>positive</code> followed by a comma.</li>
<li><code>.*</code> matches zero to any number of characters. This will run to the end of the line.</li>
<li><code>\R</code> matches the end of line characters themselves.</li>
</ul>
<p dir="auto">The second part with <code>(?:(?!\[).*\R)*</code> is slightly convoluted as I also want to match empty or blank lines and to include those in the section.</p>
<ul>
<li>The <code>(?:</code> and <code>)*</code> outer parentheses and their decoration says to repeat the stuff that’s inside zero or more times.</li>
<li><code>(?!\[).*\R</code> is the inner part and it matches any line that does not start with a <code>[</code>.</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/99972</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99972</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Sat, 22 Feb 2025 02:50:55 GMT</pubDate></item><item><title><![CDATA[Reply to Efficiently select&#x2F;copy bookmarked lines and their collapsed contents altogether? on Thu, 20 Feb 2025 17:12:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a><br />
In a generic form (.ini), I want to select the header and its contents, where the header/comment before/after the keyword (ie. <strong>positive</strong>) are unique.</p>
<pre><code>[unique_header1]; positive, unique_comment1
aaa
...
[unique_header2]; negative, unique_comment2
bbb
...
[unique_header3]; positive, unique_comment3
ccc
...
[unique_headerz]; positive, unique_commentz
zzz
...
</code></pre>
<p dir="auto">What modification should I have to the regex? Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99948</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99948</guid><dc:creator><![CDATA[Fermi]]></dc:creator><pubDate>Thu, 20 Feb 2025 17:12:39 GMT</pubDate></item><item><title><![CDATA[Reply to Efficiently select&#x2F;copy bookmarked lines and their collapsed contents altogether? on Wed, 19 Feb 2025 21:50:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fermi" aria-label="Profile: Fermi">@<bdi>Fermi</bdi></a> said in <a href="/post/99930">Efficiently select/copy bookmarked lines and their collapsed contents altogether?</a>:</p>
<blockquote>
<p dir="auto">I guess I’ve over-simplified the problem earlier. I’m having something more general like: [long_random_stringx_sectiony, positive, long_random_stringy] as the section header.</p>
</blockquote>
<p dir="auto">Please take a look at <a href="https://community.notepad-plus-plus.org/topic/15739/faq-request-for-help-without-sufficient-information-to-help-you">FAQ: Request for Help without sufficient information to help you</a>.  I think that will help you ask a question here where the answers you get will be useful or helpful to you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99931</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99931</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Wed, 19 Feb 2025 21:50:32 GMT</pubDate></item><item><title><![CDATA[Reply to Efficiently select&#x2F;copy bookmarked lines and their collapsed contents altogether? on Wed, 19 Feb 2025 18:19:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fermi" aria-label="Profile: Fermi">@<bdi>Fermi</bdi></a> If your data closely matches the layout that you showin your screen shots then  try this:</p>
<p dir="auto">Step 1 - add one line at the bottom of the file that has</p>
<pre><code class="language-txt">[section999, end]
</code></pre>
<p dir="auto">The exact details of that line do not matter other than we want the <code>[section999</code> part.</p>
<p dir="auto">Step 2 - Do a Mark-all using this regular expression</p>
<pre><code>^(\[section[0-9]+, positive\]\R(?:(?!\[section[0-9]+).+\R)*)+
</code></pre>
<p dir="auto">If you experiment with searching using that expression you will find that it matches blocks of consecutive <code>positive</code> sections.  The reason for the <code>[section999, end]</code> line is to deal with if the last section is <code>positive</code> and there is stuff after that section that you don’t want.</p>
<p dir="auto">If you don’t have stuff in the file after the last section then you don’t need the <code>[section999, end]</code> line.</p>
<p dir="auto">If you have blank lines in your sections then change the <code>(?!\[section[0-9]+).+</code> part to <code>(?!\[section[0-9]+).*</code>  As it is, if you have no blank lines then you can use <code>.+</code> and instead of an <code>[section999, end]</code> line  you can add one blank line.</p>
<p dir="auto">Step 3 - Do a mark-all and then Copy-all-marked lines.</p>
<p dir="auto">That will load all of the <code>positive</code> sections into the copy/ paste buffer in one shot.</p>
<p dir="auto">Here’s the breakdown of what’s happening in</p>
<pre><code class="language-txt">^(\[section[0-9]+, positive\]\R(?:(?!\[section[0-9]+).+\R)*)+
</code></pre>
<ol>
<li>The outer <code>^(</code> … <code>)+</code> parentheses allow for consectitive positive blocks. This is optional as we are doing a mark-all  Having this makes a plain search to see what it makes make more sense.</li>
<li>The <code>\[section[0-9]+, positive\]\R</code> part matches the start of a <code>positive</code> section.</li>
<li>Right after that is <code>(?:(?!\[section[0-9]+).*\R)*</code> which matches zero or more lines within a section with the end of the match being the start of the next section. Essentially, I’m matching all lines that do <strong>not</strong> start with  <code>\[section[0-9]+</code>.  If your data includes lines that start with something line <code>[section999</code> then you may need to expand that part of the regexp.</li>
</ol>
]]></description><link>https://community.notepad-plus-plus.org/post/99923</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99923</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Wed, 19 Feb 2025 18:19:49 GMT</pubDate></item><item><title><![CDATA[Reply to Efficiently select&#x2F;copy bookmarked lines and their collapsed contents altogether? on Wed, 19 Feb 2025 00:39:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fermi" aria-label="Profile: Fermi">@<bdi>Fermi</bdi></a></p>
<p dir="auto">So, the following has nothing to do with bookmarks at all…</p>
<p dir="auto">But if you put your caret at the beginning of line 4 and press Shift + DownArrow, line 4 will appear selected and your caret will be at the start of line 7.  If you then press Ctrl+c, the text copied will include lines 4, 5 and 6.</p>
<p dir="auto">If you’re looking for more “advanced” functionality than that, you’re out of luck.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99910</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99910</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 19 Feb 2025 00:39:31 GMT</pubDate></item></channel></rss>