<?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[Copy Regular Expression Search Results to Clipboard]]></title><description><![CDATA[<p dir="auto">Really appreciate Notepad++, and was extremely happy to find ths “Search” included Regular Expressions! WOW!<br />
I used them and got exactly what I wanted highlighted… GREAT.<br />
However, when I tried to figure out how to copy the search results, I could not find out how…<br />
So close, but failure.<br />
Is there a way to copy search results to the clipboard?</p>
<p dir="auto">All help much appreciated!<br />
Bob</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/10839/copy-regular-expression-search-results-to-clipboard</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 23:58:40 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/10839.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Nov 2015 16:29:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Copy Regular Expression Search Results to Clipboard on Fri, 20 Nov 2015 21:06:35 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>Robert</strong> and <strong>Janet</strong>,</p>
<p dir="auto">Seemingly, as you seem comfortable with <strong>regular expressions</strong>, you could easily <strong>extract</strong> the <strong>matched strings</strong> with a simple regex ?</p>
<p dir="auto">For instance, let’s suppose the simple <strong>list</strong> of people of an enterprise, below :</p>
<pre><code>Occupation   Age   Title     Name    Forename
---------------------------------------------
Technician    50    Mr      SMITH     John
Secretary     25    Miss    BROWN     Amy
Manager       40    Mrs     HARPER    Edith
.......       ..    ...     ......    .....
</code></pre>
<p dir="auto">and that you would like to do some <strong>statistics</strong>, depending on the <strong>age</strong> and/or the <strong>title</strong> of these persons. Then, you would need, ( may be for confidentiality ! ) to extract, ONLY, the <strong>second</strong> and <strong>third</strong> columns of that list. If so :</p>
<ul>
<li>
<p dir="auto">Copy this list in an <strong>new</strong> tab of N++</p>
</li>
<li>
<p dir="auto">Perform the <strong>S/R</strong>, below, in <strong>Regular expression</strong> search mode :</p>
</li>
</ul>
<p dir="auto">SEARCH <strong><code>.*?(\d+ +\w+).*</code></strong></p>
<p dir="auto">REPLACE <strong><code>\1</code></strong></p>
<hr />
<p dir="auto">If, in addition, you would prefer to <strong>delete any</strong> line, that <strong>does NOT match</strong> the regex, use, instead the <strong>S/R</strong> below :</p>
<p dir="auto">SEARCH <strong><code>.*?(\d+ +\w+).*|^.*\R</code></strong></p>
<p dir="auto">REPLACE <strong><code>\1</code></strong></p>
<p dir="auto">You’ll only get the <strong>strings</strong> matched by the <strong>regex</strong>, below :</p>
<pre><code>50    Mr
25    Miss
40    Mrs
</code></pre>
<p dir="auto"><strong>Note</strong> :</p>
<p dir="auto">If the regex <strong>can’t</strong> be found, the <strong>first</strong> part of the alternative is <strong>not</strong> matched ( so, the group <strong>\1</strong> doesn’t exist ) but the <strong>second</strong> part of the alternative is, obviously, <strong>always</strong> matched, as it matches an <strong>entire</strong> line, with its <strong>EOL</strong> character(s)</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12183</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12183</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 20 Nov 2015 21:06:35 GMT</pubDate></item><item><title><![CDATA[Reply to Copy Regular Expression Search Results to Clipboard on Fri, 20 Nov 2015 17:32:10 GMT]]></title><description><![CDATA[<p dir="auto">I’m not 100% sure what you want to copy.</p>
<p dir="auto">If you want to copy <em>some particular</em> matching string, you can double click on the line in the search window, which will open (if necessary) the file and move the focus to it.  The text that matched the regex will be selected, so you can then copy it to the clipboard.</p>
<p dir="auto">If you want to copy <em>all</em> the occurrences of matching strings, then I think you are out of luck (at least as far as Notepad++ goes). You could probably use a scripting language like GAWK, PERL, or Python to spit out just the matching text in a file, which might get you close to what you want.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12180</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12180</guid><dc:creator><![CDATA[Jim Dailey]]></dc:creator><pubDate>Fri, 20 Nov 2015 17:32:10 GMT</pubDate></item><item><title><![CDATA[Reply to Copy Regular Expression Search Results to Clipboard on Fri, 20 Nov 2015 16:36:46 GMT]]></title><description><![CDATA[<p dir="auto">Yes,  this gives me every line containing the RegEx, but I just want the part the RegEx selected.<br />
Is there a way to get just that?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12177</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12177</guid><dc:creator><![CDATA[Robert Or Janet Diebel]]></dc:creator><pubDate>Fri, 20 Nov 2015 16:36:46 GMT</pubDate></item><item><title><![CDATA[Reply to Copy Regular Expression Search Results to Clipboard on Thu, 19 Nov 2015 22:31:24 GMT]]></title><description><![CDATA[<p dir="auto">Right mouse click in the find results window and pick <em>Select all</em>.<br />
Right mouse click in the find results window and pick <em>Copy</em>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12171</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12171</guid><dc:creator><![CDATA[Jim Dailey]]></dc:creator><pubDate>Thu, 19 Nov 2015 22:31:24 GMT</pubDate></item></channel></rss>