<?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[Few Questions about selection, copy &amp; masked paste]]></title><description><![CDATA[<p dir="auto">Hi guys,</p>
<p dir="auto">so I got some kind of little multi question I would like to bundle into one post if you don’t mind.</p>
<p dir="auto">1.) How to auto select everything between marker words / chars etc?</p>
<p dir="auto">I have a large text file and inside are markers to find like this <em>|</em> which represent the start &amp; end markers. Now I would like to find the first marker and the next marker and select them including the text between like this…</p>
<pre><code>Some text here - don't touch it
*|* Here all text I want 
to get selected *|*
Some text here - don't touch it
*|* Here all text I want 
to get selected *|*
</code></pre>
<p dir="auto">So in this case npp should select all text between the markers + the markers itself. The text between the markers is of course unknown about length etc. Now imagine I have tons of those markers + text in a document I want to select and delete or copy etc.</p>
<p dir="auto">2.) How to select desired entire lines using specific markers and how to delete everything else around?</p>
<p dir="auto">Example: In this case I have again markers inside of the document but just single markers like a specific variable name like CARS:  FLY:  OEP:. Now I wanna tell npp to find all lines in text using those three marker words and select the entire text lines + optional delete everything else. Some kind of invert selection etc you know.</p>
<pre><code>Some random text here
CARS: This line I want to get selected
Some random text here
Some random text here
text and text OEP: This line I want to get selected too
Some random text here
FLY: This line I want to get selected too
Some random text here
</code></pre>
<p dir="auto">Above you can see example text with those markers and I want to select every entire line where a marker was found. Then I wanna copy them to new file (optional) or better is I want to delete all text lines around which would look like this at the end…</p>
<pre><code>CARS: This line I want to get selected
text and text OEP: This line I want to get selected too
FLY: This line I want to get selected too
</code></pre>
<p dir="auto">3.) How to copy &amp; paste with mask?</p>
<p dir="auto">Special question. I would like to select and copy (don’t know how to explain it correctly) with some mask. Below a example…<br />
Text A</p>
<pre><code>AAAAAAAAAA

AAAAAAAAAA

AAAAAAAAAA

AAAAAAAAAA

AAAAAAAAAA
</code></pre>
<p dir="auto">Text B</p>
<pre><code>BBBBBBBBBB

BBBBBBBBBB

BBBBBBBBBB

BBBBBBBBBB

BBBBBBBBBB
</code></pre>
<p dir="auto">…so as yo can see I have 2 text files. First one just showing A’s then free line or just spaces and the other text showing same with B’s. Now I would like to select entire Text A copy it and then I go to Text B set the mouse pointer at line 2 (which is empty) and past all from Text A into Text B but without to overwrite Text A and the result would look like this…</p>
<pre><code>AAAAAAAAAA
BBBBBBBBBB
AAAAAAAAAA
BBBBBBBBBB
AAAAAAAAAA
BBBBBBBBBB
AAAAAAAAAA
BBBBBBBBBB
AAAAAAAAAA
BBBBBBBBBB
</code></pre>
<p dir="auto">…which is some kind of masked copy / paste operation I think. So is that doable anyhow with npp? Just keep my previous questions in mind I want to select specific text between markers or entire lines. Now I copy &amp; paste them into new files and now I want also paste other things in that new file at specific positions but without to over paste anything from text before you know. Do you guys have some ideas how to make it work using npp?</p>
<p dir="auto">4.) Optional question about macros. I was trying to make a own macro to find a marker A in text + start selection + find marker B + end selection. But somehow I don’t get it work because when I search anything in search box then I can’t start a selection with pressed shift key. You know what I mean right? How to make this work? So this question is related to my question 1. Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26408/few-questions-about-selection-copy-masked-paste</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 10:52:10 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26408.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 27 Nov 2024 23:14:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Fri, 29 Nov 2024 17:04:41 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a>,</p>
<p dir="auto">thanks again for that new detailed info’s about RegEx. I was testing a little around and now I see what you mean about that selection thing I would like to do. So it means I just can do it with a RegEx pattern only without any manually mouse move / key buttons. I also did notice that the entire pattern / data I do paste in the search mask gets also saved like that if I record a macro. So before I thought it would be just save every single key press or combo only. That’s a good news for me. Now it’s working to make the selection between 2 markers and do anything with it.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a><br />
What do you mean? Just wanna know and find out answers to the question I have you know.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98306</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98306</guid><dc:creator><![CDATA[Dean-Corso]]></dc:creator><pubDate>Fri, 29 Nov 2024 17:04:41 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Fri, 29 Nov 2024 11:13:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> said:</p>
<blockquote>
<p dir="auto">I’m trying to understand your next question related to finding the AAAA, then the EEEE and then selecting all in between. The Find function will do all that in one click, so long as the regex pattern fits what you are looking for.</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@Dean-Corso</a> seems very determined to want to do this in two distinct <em>Find</em> operations, for some still-hidden-from-the-rest-of-us reason.</p>
<p dir="auto">I’d suggest that he post his real-world reason for wanting/needing this, and forget the AAABBBCCCDDDEEE mockup.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98293</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98293</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 29 Nov 2024 11:13:53 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Fri, 29 Nov 2024 02:12:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@Dean-Corso</a> said in <a href="/post/98284">Few Questions about selection, copy &amp; masked paste</a>:</p>
<blockquote>
<p dir="auto">About the find / select problem.</p>
</blockquote>
<p dir="auto">Short answer is yes!</p>
<p dir="auto">It would seem that you maybe don’t understand what the regex <code>(?s)(\Q*|*\E).+?\1\R?</code> is selecting? Have you entered that into the <a href="http://regex101.com" rel="nofollow ugc">regex101.com</a> site. The description there is fairly detailed and better than I could describe. However I will try to explain in simple terms the components.<br />
<code>(?s)</code> refers to what the DOT character is allowed to include. In this case it is all characters including the line feed and carriage return ones (essentially end of line). Using this allows for any DOT character in the regex to cross lines, so multi-line capable. That essentially answers one of your questions about how to cover a multi-line selection between AAAAA and EEEEE.</p>
<p dir="auto">The <code>\Q</code> and <code>\E</code> surround characters that we want interpreted as literals, in this example that is the <code>*|*</code> string. I referred to meta-characters in my first answer to your opening post. This allows those meta-characters to ONLY be interpreted as literals. There is another method, called “escaping” the meta-character which I referred to. Either method is acceptable.</p>
<p dir="auto"><code>.+?</code> means to continue selecting characters in a non-greedy fashion. This combined with the <code>\1</code> means the regex expands forward in a cautious fashion, testing at each advancement that the following characters aren’t equivalent to the preceding group #1 which is the <code>(\Q*|*\E)</code>. As soon as it sees in front of the caret (current position in the text) that string, it stops advancing and goes to the next sub-expression in the regex pattern, the <code>\1</code> which we know is really the <code>(\Q*|*\E)</code>.</p>
<p dir="auto">The <code>\R?</code> refers to the end of line characters, whether they be line feed, carriage return or both. Windows Linux and Mac all use differing sets of these as default for line endings. In Notepad++, go to the Edit menu, then EOL conversion and see the 3 options.</p>
<p dir="auto">Of course in your latest example you would want to select the multi-line string surrounded by AAAAA and EEEEEE. That means the example regex I’ve been referring to would need to be altered. Something like <code>(?s-i)A+.+?E+</code>. Note that it looks very different from the previous regex, in fact it is just a variation on that. Firstly I’ve included another modifier, the <code>-i</code>, this refers to the case of the characters, read that at <a href="http://rexegg.com" rel="nofollow ugc">rexegg.com</a>. As the start and end delimiters (your AAAA and EEEE) aren’t the same character strings we can’t reference group 1. I also removed the \R? requirement as maybe your EEEEE delimiter finishes part way along a line.</p>
<p dir="auto">Perhaps I’ve written enough (more than, I think). You really do need to read up on this and start to have a go yourself. We are here to help but currently I think you need to attempt some regex of your own. Likely you won’t get it exactly right first time, but with time and trials comes the knowledge.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98285</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98285</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 29 Nov 2024 02:12:04 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Fri, 29 Nov 2024 01:33:47 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a>,</p>
<p dir="auto">thanks for that website so I will check this out.</p>
<p dir="auto">About the find / select problem. So I want to create a macro using search function to X and if it was found it should start the selection including X and as second step I want to find Y and if found then it should expand the selection from X to Y…</p>
<pre><code>X anything here Y
</code></pre>
<p dir="auto">…so all that should get selected. Lets say I have some static text / code where I know that X &amp; Y are always there. I want to find &amp; select it and delete that part and this in loop mode. For that I wanna create a simple macro for quickly use if I need it without to think about it again next time and playing around (I forget pretty quick and need to create some auto stuff etc you know). Just have the problem to make that selection + holding it till searching the second variable Y. Just wanna know whether I can handle that with macro or not.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98284</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98284</guid><dc:creator><![CDATA[Dean-Corso]]></dc:creator><pubDate>Fri, 29 Nov 2024 01:33:47 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Fri, 29 Nov 2024 00:37:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@Dean-Corso</a> said in <a href="/post/98279">Few Questions about selection, copy &amp; masked paste</a>:</p>
<blockquote>
<p dir="auto">Do you know any simple source to learn / refresh RegEx stuff? I always forget that!</p>
</blockquote>
<p dir="auto">I would go to <a href="http://rexegg.com" rel="nofollow ugc">rexegg.com</a> as it identifies the modifiers in a concise way. Lot’s of other stuff there. Bear in mind it is fairly generic and in some cases the regular expression engine used in Notepad++ won’t fit exactly the examples used. As is the case with most stuff one learns, it can become a bit rusty if not regularly used, however a good grounding will mean you generally know what’s possible even if you don’t know the exact syntax.</p>
<p dir="auto">I’m trying to understand your next question related to finding the AAAA, then the EEEE and then selecting all in between. The Find function will do all that in one click, so long as the regex pattern fits what you are looking for. The pattern you listed in that post is exactly that sort of pattern you seem to want to use.</p>
<p dir="auto">Put that pattern into <a href="http://regex101.com" rel="nofollow ugc">regex101.com</a> and read the description on the right side.</p>
<p dir="auto">I’m wondering if you have only ever been using the normal search mode where everything is literal and for the exact number as used in a pattern. Regex allows for string lengths (and exact content) searched on to change without having to change or reset the pattern.</p>
<p dir="auto">There is a FAQ post <a href="https://community.notepad-plus-plus.org/topic/15765/faq-where-to-find-regular-expressions-regex-documentation">here</a> that contains many regex references and sources of info. Additionally lower down the post it refers to a 3rd edition of a book with a PDF link to download and read it offline. it is fairly involved so it will take some time to digest all that it contains but it has a great wealth of information.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98282</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98282</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 29 Nov 2024 00:37:29 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Fri, 29 Nov 2024 00:07:31 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a>,</p>
<p dir="auto">thanks again for another answer. So your RegEx pattern…</p>
<pre><code>(?s)(\Q*|*\E).+?\1\R?
</code></pre>
<p dir="auto">…works now with the question mark at the end. Do you know any simple source to learn / refresh RegEx stuff? I always forget that!</p>
<p dir="auto">So I also need to find out whether its possible in npp to “find / start selection / find / end selection” anyhow specially when trying to record a macro.</p>
<pre><code>AAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEE
</code></pre>
<p dir="auto">Above you can see some letters just random. Now I want to find AAAA and if it was found it should select it and as next it should find EEEE and if this was found it should select it. I mean the selection would start at AAAA til EEEE but how to do that manually and to record a macro for that? So I can do the find operations but without the selection part you know. Is it just not doable or is there any special method I could do? How to set &amp; keep the selection enabled after first found to expand it til next found etc? Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98279</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98279</guid><dc:creator><![CDATA[Dean-Corso]]></dc:creator><pubDate>Fri, 29 Nov 2024 00:07:31 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Thu, 28 Nov 2024 11:04:21 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@dean-corso</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@terry-r</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26710">@mark-olson</a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@dean-corso</a>, you said :</p>
<blockquote>
<p dir="auto">Thank you too for the BIG answer. So the RegEx pattern seems not to work when using it in npp and finds nothing etc. The second one seems to work which is similar to <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> pattern.</p>
</blockquote>
<p dir="auto">Well, I don’t know what happened, but I can assure you that the regex <strong><code>(?s)(\Q*|*\E).+?\1\R</code></strong> works fine !</p>
<hr />
<ul>
<li>Place your <strong>test</strong> block, below, in a <strong>new</strong> tab</li>
</ul>
<pre><code class="language-diff">Some text here - don't touch it
*|* Here all text I want 
to get selected *|*
Some text here - don't touch it
*|* Here all text I want 
to get selected *|*
</code></pre>
<ul>
<li>
<p dir="auto">Open the <strong>Search</strong> or <strong>Mark</strong> dialog :</p>
</li>
<li>
<p dir="auto"><strong>Uncheck</strong> all the <strong>box</strong> options</p>
</li>
<li>
<p dir="auto">SEARCH / MARK <strong><code>(?s)(\Q*|*\E).+?\1\R?</code></strong></p>
</li>
<li>
<p dir="auto">Check the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">If you chose the <strong>Mark</strong> dialog, check also the <strong>two</strong> options <strong><code>Bookmark line</code></strong> and <strong><code>Purge for each search</code></strong></p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> option</p>
</li>
</ul>
<p dir="auto">Now, either :</p>
<ul>
<li>Click on the <strong><code>Find Next</code></strong> button, <strong>several</strong> times, to get the <strong>successive</strong> occurrences</li>
</ul>
<p dir="auto">or</p>
<ul>
<li>Click on the <strong><code>Mark all</code></strong> button to mark, at once, <strong>all</strong> the occurrences</li>
</ul>
<p dir="auto">You should get, <strong>two</strong> distinct selections !</p>
<hr />
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong><code>(?s)</code></strong> syntax means that the <strong>regex</strong> dot char <strong><code>.</code></strong> represents <strong>absolutely</strong> any character ( a <strong>standard</strong> or <strong>EOL</strong> one ! )</p>
</li>
<li>
<p dir="auto">The <strong><code>\E</code></strong> and <strong><code>\Q</code></strong> syntaxes ensures that <strong>all</strong> text, located between them, is taken <strong><code>literally</code></strong>. Indeed, <strong><code>*</code></strong> and <strong><code>|</code></strong> have a <strong>special</strong> signification in <strong>regular</strong> expressions !</p>
</li>
<li>
<p dir="auto">The <strong><code>.+?</code></strong> syntax represents the <strong>smaller</strong> range of text, even splitted in <strong>several</strong> lines, found between the two <strong><code>*|*</code></strong> boundaries</p>
</li>
<li>
<p dir="auto">The <strong><code>\1</code></strong> syntax just stands for the <strong>group <code>1 </code></strong>, <strong><code>(\Q*|*\E)</code></strong> , between <strong>parentheses</strong>, so the boundary <strong><code>\Q*|*\E</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>\R?</code></strong> syntax represents an <strong>optional end</strong> of line character(s). So, either the <strong><code>\n</code></strong>, <strong><code>\r</code></strong> or <strong><code>\r\n</code></strong> characters or <strong>nothing</strong>. Indeed, we must take in account that, possibly, <strong>all</strong> the searched text is at the <strong>very end</strong> of the file !</p>
</li>
</ul>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98251</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98251</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 28 Nov 2024 11:04:21 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Thu, 28 Nov 2024 02:07:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a></a><br />
Thank you too for the BIG answer. So the RegEx pattern seems not to work when using it in npp and finds nothing etc. The second one seems to work which is similar to <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> pattern.</p>
<p dir="auto">Your answer to question 3 is somehow complicated because I have already the text with empty lines but OK. The second part of your answer really seems to work just using alt+mouse to make the rect selection then strg+C to trim the selection to text and copy and paste it into empty line start of the other text block. Very Good <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a></a>. :-)</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a><br />
No no and sorry if I wasn’t clear for 100% with my questions. So the markers on question 1 could be anything and places anywhere in text. Only static value is that there are 2 markers with possibly any text inside I need to select. The marker could be also differently for start &amp; end like <em>S</em> and <em>E</em> for example. So this I need to adjust in your RegEx pattern when using it. The markers could be same or different. Sorry, my RegEx skills are pretty bad because I’m using it rarely and after few months I did forget everything again.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98243</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98243</guid><dc:creator><![CDATA[Dean-Corso]]></dc:creator><pubDate>Thu, 28 Nov 2024 02:07:33 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Thu, 28 Nov 2024 01:17:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@Dean-Corso</a> said in <a href="/post/98240">Few Questions about selection, copy &amp; masked paste</a>:</p>
<blockquote>
<p dir="auto">So the markers do not start at the line start so</p>
</blockquote>
<p dir="auto">Ah, the age old problem of dumbing down the examples so as to make it easier for us to solve. Yet as you found out we haven’t.</p>
<p dir="auto">It would pay to expand on each of the examples, give us the parameters. Your first expansion is that the first marker of a set doesn’t necessarily start at the commencement of a line. Anything else? Maybe it doesn’t necessarily finish at the end of a line either? Very important and sorry but because of the uncertainty of your actual needs I might just wait on the sidelines.</p>
<p dir="auto">Terry</p>
<p dir="auto">PS I did actually change my #1 solution in light of your change in parameters to be <code>(?s)\*\|\*.+?(?=\*\|\*)\*\|\*</code>. So can start and finish anywhere on line. Don’t use bookmark lines feature as you dont want entire line. But the selected text will still be highlighted. on the Mark function window so you can copy selected text. However upon pasting that into a new tab you will likely find lines with <code>----</code> denoting the separate selections you copied. That would then entail more work, so maybe not the right answer either.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98242</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98242</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 28 Nov 2024 01:17:57 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Thu, 28 Nov 2024 10:47:19 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@dean-corso</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@terry-r</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26710">@mark-olson</a> and <strong>All</strong>,</p>
<p dir="auto">I <em>CANNOT</em> develop right now, because it’s about <strong><code>02.00 am</code></strong>, in France and… I’m a bit <strong>sleepy</strong> !</p>
<hr />
<p dir="auto">However, regarding your <strong>first</strong> question, it can be solved with the following regex :</p>
<ul>
<li>SEARCH <strong><code>(?s)(\Q*|*\E).+?\1\R</code></strong></li>
</ul>
<hr />
<p dir="auto">Now, regarding your <strong>second</strong> question, I would use the <strong>Mark</strong> dialog ( <strong><code>Ctrl + M</code></strong> ) and the following regex :</p>
<ul>
<li>MARK <strong><code>(?-i)(?:CARS|OEP|FLY):</code></strong></li>
</ul>
<p dir="auto"><strong>Note</strong> : don’t forget to check the <strong><code>Bookmark line</code></strong> option in order to run, lately, an option of the  <strong><code>Search &gt; Bookmark</code></strong> menu option</p>
<hr />
<p dir="auto">Finally, concerning your <strong>third</strong> question, here is a <strong>real</strong> bunch of text for testing ( Beginning of the <strong>first</strong> chapter of the <strong><code>Moby Dick</code></strong> novel ! )</p>
<p dir="auto">I, <strong>deliberately</strong>, separated all the <strong>odd</strong> lines, to mimic your <strong><code>AAAAAAAAAA</code></strong> lines, and all the <strong>even</strong> lines, to mimic your <strong><code>BBBBBBBBBB</code></strong> lines</p>
<p dir="auto">Thus, we get :</p>
<pre><code class="language-diff">Call me Ishmael. Some years ago—never mind how long precisely—having
on shore, I thought I would sail about a little and see the watery part
regulating the circulation. Whenever I find myself growing grim about
I find myself involuntarily pausing before coffin warehouses, and
my hypos get such an upper hand of me, that it requires a strong moral
methodically knocking people’s hats off—then, I account it high time to
With a philosophical flourish Cato throws himself upon his sword; I
but knew it, almost all men in their degree, some time or other,
</code></pre>
<p dir="auto">And :</p>
<pre><code class="language-diff">little or no money in my purse, and nothing particular to interest me
of the world. It is a way I have of driving off the spleen and
the mouth; whenever it is a damp, drizzly November in my soul; whenever
bringing up the rear of every funeral I meet; and especially whenever
principle to prevent me from deliberately stepping into the street, and
get to sea as soon as I can. This is my substitute for pistol and ball.
quietly take to the ship. There is nothing surprising in this. If they
cherish very nearly the same feelings towards the ocean with me.
</code></pre>
<p dir="auto">Now, for these <strong>two</strong> blocks of text :</p>
<ul>
<li>
<p dir="auto">Place the caret at the <strong>very beginning</strong> of their <strong>first</strong> line</p>
</li>
<li>
<p dir="auto">Do a <strong>zero-width</strong> rectangular selection of their <strong><code>eight</code></strong> lines ( Hit simultaneously the <strong><code>Alt</code></strong> and <strong><code>Shift</code></strong> keys and, at the <strong>same</strong> time, hit <strong>seven</strong> times on the <strong><code>Down</code></strong> arrow</p>
</li>
<li>
<p dir="auto">Hit the <strong><code>End </code></strong> key and then press the <strong><code>Enter</code></strong> key</p>
</li>
</ul>
<p dir="auto">The texts are now changed as below :</p>
<pre><code class="language-diff">Call me Ishmael. Some years ago—never mind how long precisely—having

on shore, I thought I would sail about a little and see the watery part

regulating the circulation. Whenever I find myself growing grim about

I find myself involuntarily pausing before coffin warehouses, and

my hypos get such an upper hand of me, that it requires a strong moral

methodically knocking people’s hats off—then, I account it high time to

With a philosophical flourish Cato throws himself upon his sword; I

but knew it, almost all men in their degree, some time or other,

</code></pre>
<p dir="auto">And :</p>
<pre><code class="language-diff">little or no money in my purse, and nothing particular to interest me

of the world. It is a way I have of driving off the spleen and

the mouth; whenever it is a damp, drizzly November in my soul; whenever

bringing up the rear of every funeral I meet; and especially whenever

principle to prevent me from deliberately stepping into the street, and

get to sea as soon as I can. This is my substitute for pistol and ball.

quietly take to the ship. There is nothing surprising in this. If they

cherish very nearly the same feelings towards the ocean with me.
</code></pre>
<ul>
<li>
<p dir="auto">Now, put the caret right before the word <strong><code>little</code></strong> of the <strong>first</strong> line of the <strong>second</strong> block</p>
</li>
<li>
<p dir="auto">Again,  do a <strong>zero-width</strong> rectangular selection of their <strong><code>eight</code></strong> lines</p>
</li>
<li>
<p dir="auto">While holding down the <strong><code>Alt</code></strong> and <strong><code>Shift**</code></strong> keys, select <strong>all</strong> the contents of the <strong>second</strong> block, with the <strong><code>Right</code></strong> arrow</p>
</li>
<li>
<p dir="auto">Use the <strong><code>Ctrl + C</code></strong> or <strong><code>Ctrl + X</code></strong> shortcut</p>
</li>
<li>
<p dir="auto">Move the caret on the <strong>first empty</strong> line, right below the <strong>first</strong> line of the <strong>first</strong> block ( <strong><code>Call me Ishmael.</code></strong> )</p>
</li>
<li>
<p dir="auto">Use the <strong><code>Ctrl + V</code></strong> shortcut</p>
</li>
</ul>
<p dir="auto">=&gt; The beginning of the chapter I should be <strong>reconstituted</strong>, as below :</p>
<pre><code class="language-diff">Call me Ishmael. Some years ago—never mind how long precisely—having
little or no money in my purse, and nothing particular to interest me
on shore, I thought I would sail about a little and see the watery part
of the world. It is a way I have of driving off the spleen and
regulating the circulation. Whenever I find myself growing grim about
the mouth; whenever it is a damp, drizzly November in my soul; whenever
I find myself involuntarily pausing before coffin warehouses, and
bringing up the rear of every funeral I meet; and especially whenever
my hypos get such an upper hand of me, that it requires a strong moral
principle to prevent me from deliberately stepping into the street, and
methodically knocking people’s hats off—then, I account it high time to
get to sea as soon as I can. This is my substitute for pistol and ball.
With a philosophical flourish Cato throws himself upon his sword; I
quietly take to the ship. There is nothing surprising in this. If they
but knew it, almost all men in their degree, some time or other,
cherish very nearly the same feelings towards the ocean with me.
</code></pre>
<hr />
<p dir="auto">See you tomorrow, for more details !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> : I’ve just seen that you already have some solutions to study, provided by <strong>Mark</strong> and <strong>Terry</strong> !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98241</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98241</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 28 Nov 2024 10:47:19 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Thu, 28 Nov 2024 01:03:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26710">@Mark-Olson</a></p>
<p dir="auto">Thank you for your answer. I tried checking out your PY script but its not what I’m looking for. I’m working with temporary npp tabs and don’t wanna merge files together. In my case I want to do it with selections (copy / paste / masked) you know. So about question 2, your RegEx pattern seems to work to find it but how to get all of them selected? I can mark the matches only etc. Would be nice if there would be any simple npp function for selection too or is this hidden? Did nobody else had that idea before to select all marks too? Sorry, just asking so maybe I didn’t found the function/s yet. But thank you so far of course.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a></p>
<p dir="auto">Thank you for your answers so far too. So I tried your steps to see whether they work. First problem is about my question 1. So the markers do not start at the line start so they are anywhere what means I have to change your RegEx pattern to this now…</p>
<pre><code>(?s)\*\|\*.+?(?=\*\|\*)\*\|\*
</code></pre>
<p dir="auto">…and it works as you said but the problem are the bookmarks now. I don’t need the entire lines so I just need to select all marked text portions at this moment but how to select them all at once? I see there is a Copy Marked Text button what does it somehow but not 1:1. I would like to have same positions as original and everything else should be masked with white spaces. In this case a masked copy function would be good if there is any. So otherwise, I would like to remove all marked text OR everything around. So I’m still missing such functions in npp like “Select Marked Text” &amp; “Invert Selection” specially in case of using multi selections you know.</p>
<p dir="auto">About question 2: In this case it seems to work pretty well using your method with the bookmarks. Thank you for that one. So I hope to get some possibly more answers later about my other questions too.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98240</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98240</guid><dc:creator><![CDATA[Dean-Corso]]></dc:creator><pubDate>Thu, 28 Nov 2024 01:03:34 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Wed, 27 Nov 2024 23:54:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/28934">@Dean-Corso</a> said in <a href="/post/98236">Few Questions about selection, copy &amp; masked paste</a>:</p>
<blockquote>
<p dir="auto">so I got some kind of little multi question I would like to bundle into one post</p>
</blockquote>
<p dir="auto">As you have a number of questions it will likely be that it will take multiple posts to answer them all. Some of the answers are relatively straight forward, others will take some time to explain, with examples. Others still might make reference to other (older) posts, I’m thinking the “interleaving of 2 files’ data”, your question #4.</p>
<p dir="auto">For question #1, it involves the use to regex (regular expressions). There are plenty of references both in our FAQ section and on the Internet. In short they look like a filter to look for strings of characters. With regex there are a number of characters called meta-characters. These carry special meaning in the expression and to use literally they need to be prefixed with the “escape” <code>\</code> character.</p>
<p dir="auto">So looking at your small example of #1 it seems the marker starts at the commencement of a line and finishes at the end of a line, so possibly multiple lines in between. You haven’t actually stated what the end goal is with the selected portions of the file (between markers) is. For my solution I would expect you want to copy only the selected portions to another file.</p>
<p dir="auto">So using the “Mark” function we have:<br />
Find What:<code>(?s)^\*\|\*.+?(?=\*\|\*)\*\|\*$</code><br />
Tick Bookmark Line and have the search mode set to “regular expression”. Ideally have your cursor at the start of the file or you need to tick “wrap around”. Click on “Mark All”.</p>
<p dir="auto">At this point you will have the lines you want highlighted and have a coloured ball icon at the start of the highlighted lines. If you right click on one of those balls (actually anywhere in that column between line number if shown and the text) you have an option to copy bookmarked lines from the menu shown. You can also remove those lines at this point, or cut them. Do the copy, open a new tab/file and Ctrl-V to paste them into the new tab.</p>
<p dir="auto">Question #2. In a very similar manner to the solution for #1 we would again use the Mark function. This time the Find What field would be<br />
<code>(?-i)CARS:|FLY:|OEP:</code><br />
Tick Bookmark lines, cursor at start or “wrap around” ticked, “regular expression” as the search mode and click on Mark All. So now you will have only those lines with those exact strings marked. Note the (?-i) means “not case insensitive”, which really means exact case so CARS doesn’t equal cars, (?i) is the opposite so any line with “cars:”, “Cars:”, “cArS:” right through to CARS: would all be selected. Again right click on the ball icon in left column and you will also see the option to “remove non-bookmarked lines”. This deletes the unmarked lines, just be aware there might remain 1 final “empty” line in the file that needs removing manually.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98239</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98239</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Wed, 27 Nov 2024 23:54:54 GMT</pubDate></item><item><title><![CDATA[Reply to Few Questions about selection, copy &amp; masked paste on Wed, 27 Nov 2024 23:54:21 GMT]]></title><description><![CDATA[<p dir="auto">For question 3, it looks like you’re asking how to merge together two files, where file A has empty lines where file B has non-empty lines, and vice versa. Assuming that’s what you want, <a href="https://community.notepad-plus-plus.org/post/89018">this PythonScript script for merging files</a> that I wrote a while back may be helpful for you.</p>
<p dir="auto">For question 2, if you want to match all text in a line after <code>UPPERCASEWORD:</code>, you can use the regular expression <code>(?-si)[A-Z]+:.*</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/98238</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98238</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Wed, 27 Nov 2024 23:54:21 GMT</pubDate></item></channel></rss>