<?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 text, copy and paste to another file]]></title><description><![CDATA[<p dir="auto">Is there a way to write a macro or save key strokes to do the following:  (I’m not sure how wildcards “*” work in Search in NPP)</p>
<p dir="auto">Two NPP files are open.  Start the macro with cursor at the first position in File 1.</p>
<ol>
<li>Find “Mailto:*”  (quotes are part of the searchable text)</li>
<li>Copy highlighted text</li>
<li>Switch to File 2</li>
<li>Paste clipboard contents</li>
<li>Switch to File 1</li>
<li>Space forward</li>
</ol>
<p dir="auto">Any help would be greatly appreciated.  It’s been many years since I’ve done any coding.<br />
Thx!<br />
~Scott P</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17209/find-text-copy-and-paste-to-another-file</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 19:27:08 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17209.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Feb 2019 23:17:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find text, copy and paste to another file on Fri, 01 Mar 2019 14:56:52 GMT]]></title><description><![CDATA[<p dir="auto">That’s awesome!!  Thank you sooo much!!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40513</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40513</guid><dc:creator><![CDATA[Scott Piker]]></dc:creator><pubDate>Fri, 01 Mar 2019 14:56:52 GMT</pubDate></item><item><title><![CDATA[Reply to Find text, copy and paste to another file on Fri, 01 Mar 2019 01:54:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said:</p>
<blockquote>
<p dir="auto">(?i-s)(“Mailto:[^”]+")</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-piker" aria-label="Profile: Scott-Piker">@<bdi>Scott-Piker</bdi></a><br />
I made a small error in the above regex, although it doesn’t really matter. Note the first portion <code>(?i-s)</code>. The <code>i</code> in that position means case-insensitive, which means the <code>M</code> in Mailto was disregard as a capital and is used instead as a <code>m</code>.</p>
<p dir="auto">What I really meant to do was <code>(?-is)</code>, in this position the <code>M</code> is used as a capital letter, every letter is case sensitive. Sometimes use of this can help eliminate other words (or text strings) where the text you want may be included within something else but in a different case (lower instead of upper).</p>
<p dir="auto">The <code>'s</code> is there to signify the regex should treat each line separately. That overrides the ticking of a box in the Replace function called <code>. matches newline</code>. The <code>'i</code> overrides the other box called <code>Match case</code>. This allows us (as providers of solutions) to set up the environment as we need it in order that our regex works as expected.</p>
<p dir="auto">I don’t often provide this, and indeed for the most part it doesn’t cause any issues, however it is good programming to first setup the environment as best we can. <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> does this (almost) religiously and I do try to emulate that thinking.</p>
<p dir="auto">Terry</p>
<p dir="auto">PS if you want to understand the whole regex use<br />
<a href="https://regex101.com/" rel="nofollow ugc">https://regex101.com/</a><br />
and insert  my regex. It provides a good description of what it is doing.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40490</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40490</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 01 Mar 2019 01:54:55 GMT</pubDate></item><item><title><![CDATA[Reply to Find text, copy and paste to another file on Fri, 01 Mar 2019 00:48:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-piker" aria-label="Profile: Scott-Piker">@<bdi>Scott-Piker</bdi></a> said:</p>
<blockquote>
<p dir="auto">Find “Mailto:*”</p>
</blockquote>
<p dir="auto">I been thinking a bit more about your query and think I have a good (easy to understand) answer to solve it. In english it just involves first making a copy of the file, then on the copy we find the instances of <code>"Mailto:</code>text<code>"</code> and surround them with carriage return/line feeds. Once this is completed use the “Mark” function as I suggested earlier to select the lines that will ONLY contain "Mailto:’ text. Then under bookmark we can remove ‘unmarked’ lines.<br />
So as an example I produced this small number of lines of gibberish which also contains the text on some lines in different positions.</p>
<pre><code class="language-z">&lt;item parent="9463" "Mailto:xyz@3.com"index="9476"&gt;
    &lt;block lx="2.34999752" ly="6.58951187"
"Mailto:xyz@3.com" lz="16.3749924" ux="2.39999676" uy="6.63951397" uz="16.8749962" index="151"
material="3" look="0" up="3" color="ffcd0000"/&gt;"Mailto:xyz@3.com"
&lt;/item&gt;
"Mailto:xyz@3.com"&lt;item parent="8956" index="2458"&gt; "Mailto:xyz@3.com"
&lt;block lx="2.34999752" ly="6.58951187"
lz="16.3749924" ux="2.39999676" uy="6.63951397"
uz="16.8749962" "Mailto:xyz@3.com" index="200" material="3" look="0"
up="3" color="abcdef"/&gt;
&lt;/item&gt;
</code></pre>
<p dir="auto">I used the “Replace” function with:<br />
Find What:<code>(?i-s)("Mailto:[^"]+")</code><br />
Replace With:<code>\r\n\1\r\n</code><br />
Have search mode set as “regular expression” and wrap around ticked. Hit the “Replace All” button. Afterwards (my example) I had</p>
<pre><code class="language-z">&lt;item parent="9463" 
"Mailto:xyz@3.com"
index="9476"&gt;
    &lt;block lx="2.34999752" ly="6.58951187"

"Mailto:xyz@3.com"
 lz="16.3749924" ux="2.39999676" uy="6.63951397" uz="16.8749962" index="151"
material="3" look="0" up="3" color="ffcd0000"/&gt;
"Mailto:xyz@3.com"

&lt;/item&gt;

"Mailto:xyz@3.com"
&lt;item parent="8956" index="2458"&gt; 
"Mailto:xyz@3.com"

&lt;block lx="2.34999752" ly="6.58951187"
lz="16.3749924" ux="2.39999676" uy="6.63951397"
uz="16.8749962" 
"Mailto:xyz@3.com"
 index="200" material="3" look="0"
up="3" color="abcdef"/&gt;
&lt;/item&gt;
</code></pre>
<p dir="auto">You will see even on the line that has 2 occurrences of the text, they are all on their own lines.<br />
Now use the Mark function and type <code>Mailto</code> in the find what field and have search mode set to <code>normal</code>. Have bookmark line ticked and press “Mark All” button. Next select Bookmark (under Search main menu) and remove unmarked lines.</p>
<p dir="auto">You will be left with what you seek.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40484</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40484</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Fri, 01 Mar 2019 00:48:10 GMT</pubDate></item><item><title><![CDATA[Reply to Find text, copy and paste to another file on Fri, 01 Mar 2019 00:45:47 GMT]]></title><description><![CDATA[<p dir="auto">This is very helpful!  Thank you!  This definitely saves me some time.</p>
<p dir="auto">But, yes I would definitely like to write a macro or “regex” to do this if possible.  I would like to capture the email addresses from some HTML code and write them to a new file so I can easily build distribution lists for various teams in my org. Basically, I want to capture all text between the quotes keying off of the characters, mailto.  Then write the addresses to a new file. Or, as you mention, eliminate the text I do not want.</p>
<p dir="auto">Example:</p>
<p dir="auto">text text text text “mailto <a href="mailto:john.doe1@xyzcorp.com" rel="nofollow ugc">john.doe1@xyzcorp.com</a>”  text text text text text text text “mailto: <a href="mailto:john.doe2@xyzcorp.com" rel="nofollow ugc">john.doe2@xyzcorp.com</a>”  text text text text text text text “mailto: <a href="mailto:john.doe3@xyzcorp.com" rel="nofollow ugc">john.doe3@xyzcorp.com</a>”  text text texttext text text text “mailto: <a href="mailto:john.doe4@xyzcorp.com" rel="nofollow ugc">john.doe4@xyzcorp.com</a>”  text text text<br />
text text text text “mailto: <a href="mailto:john.doe5@xyzcorp.com" rel="nofollow ugc">john.doe5@xyzcorp.com</a>”  text text texttext text text text “mailto: <a href="mailto:john.doe6@xyzcorp.com" rel="nofollow ugc">john.doe6@xyzcorp.com</a>”  text text text text text text text “mailto: <a href="mailto:john.doe7@xyzcorp.com" rel="nofollow ugc">john.doe7@xyzcorp.com</a>”  text text texttext text text text “mailto: <a href="mailto:john.doe8@xyzcorp.com" rel="nofollow ugc">john.doe8@xyzcorp.com</a>”  text text text</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40483</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40483</guid><dc:creator><![CDATA[Scott Piker]]></dc:creator><pubDate>Fri, 01 Mar 2019 00:45:47 GMT</pubDate></item><item><title><![CDATA[Reply to Find text, copy and paste to another file on Thu, 28 Feb 2019 23:31:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-piker" aria-label="Profile: Scott-Piker">@<bdi>Scott-Piker</bdi></a><br />
Whilst this is not actually giving you the solution you are after it might still be helpful.</p>
<p dir="auto">Depending on the length of the lines containing the Mailto text you are seeking, you can use the “Mark” function under Search (main menu). In the find what field type the text in so far as the explicit (non-changing portion). So likely "Mailto:<br />
Make sure you tick the box ‘bookmark line’, then mark all. All lines with that text then have a marking in the left column.<br />
From there you use the Bookmark option (under Search - main menu) and select ‘copy bookmarked lines’. Open a new tab and paste the lines in there.<br />
From there, depending on what other text is on the same line it will require some further editing.</p>
<p dir="auto">I’m showing you this as it might be a lot simpler to work through if you aren’t used to coding.</p>
<p dir="auto">Otherwise you could perhaps give us a sample of the file, changing out private text as needed (we’d only need a few lines). The idea being we could provide you with a regex to remove all other text in the file leaving just the relevant information you seek. You’d do this on a copy of the original file.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40480</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40480</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Thu, 28 Feb 2019 23:31:47 GMT</pubDate></item></channel></rss>