<?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 and remove everything else]]></title><description><![CDATA[<p dir="auto">Could someone help me with a Find and remove function. I want to find words that are enclose by: /.<em>keyword.</em>/</p>
<p dir="auto">and remove everything else around it.<br />
there are 15,000 lines and this /.<em>keyword.</em>/ may show multiple times in one line. All I want are the keywords between this /.* .*/</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20343/find-and-remove-everything-else</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 22:40:46 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20343.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Nov 2020 17:54:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find and remove everything else on Wed, 25 Nov 2020 18:08:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: anthony-noriega">@<bdi>anthony-noriega</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Oh, yes, <strong>Alan</strong>. You’re right ! Of course, I already downloaded the portable <strong><code>v7.9.1</code></strong> version but I’m still <strong>“stuck”</strong> with the <strong><code>v7.8.5</code></strong> version which explains why I didn"t notice this <strong>recent</strong> enhancement !</p>
<p dir="auto">So, thanks to <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a>, we just have to use the <strong><code>(?-s)/\.\*\K(.+?)(?=\.\*/)</code></strong> regex, click on the <strong>Mark All</strong> button to get all the <strong>keywords</strong> and, then, click on the <strong><code>Copy Marked Text</code></strong> button and <strong>paste</strong> the results on a <strong>new</strong> document. Nice !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60153</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60153</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 25 Nov 2020 18:08:28 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Wed, 25 Nov 2020 13:36:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<p dir="auto">I had a further thought:</p>
<p dir="auto">The thread I linked to earlier, and referred to in my post just above is entitled “Marked Text Manipulation”.</p>
<p dir="auto">That relates to the current thread because a typical desire after marking some text is to copy only that text to another location, which is very similar to the topic of this “Find and remove everything else” thread.<br />
In both cases you obtain the same effective result.</p>
<p dir="auto">The new thought is that, at the time of the “Marked Text Manipulation” thread’s main discussion, there was no way to copy marked text without resorting to scripting.  Now (7.9.1-ish) there is:</p>
<p dir="auto"><img src="/assets/uploads/files/1606311261919-1f6bdae9-f91c-4b07-bfb6-5afebec8922b-image.png" alt="1f6bdae9-f91c-4b07-bfb6-5afebec8922b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Just press the indicated button after you already have marked some text.</p>
<p dir="auto">I will put a similar not in that other thread as well.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60145</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60145</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 25 Nov 2020 13:36:06 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Wed, 25 Nov 2020 01:02:40 GMT]]></title><description><![CDATA[<p dir="auto">Hi, @lan-kilborn,</p>
<p dir="auto">Yes, I agree that it looks like a <strong>redundant</strong> piece of information ! In fact, I was thinking to this <strong>old</strong> post, where I proposed a <strong>general</strong> method, for isolating <strong>literal</strong> strings or expressions matched by a <strong>given</strong> regex, rewritten on <strong>different</strong> lines :</p>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/12710/marked-text-manipulation/8" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/12710/marked-text-manipulation/8</a></p>
<p dir="auto">That’s the reason why, in my <strong>previous</strong> post,  I preferred to <strong>focus</strong> on the <strong>regexes</strong>’s explanations, thinking it could be <strong>useful</strong> to the OP, anyway !</p>
<p dir="auto">But, <strong>Alan</strong>, you’re right : my post wasn’t <strong>really</strong> needed ;-))</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60136</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60136</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 25 Nov 2020 01:02:40 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Tue, 24 Nov 2020 23:58:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<p dir="auto">But really, Guy, there isn’t anything new here over what you posted <a href="https://community.notepad-plus-plus.org/post/51760">HERE</a> – with the removal of the <code>^</code> as discussed a bit later in that thread – it’s just an application of the other posting’s idea to slightly different data.</p>
<p dir="auto">We probably should stop solving the specific problems and just point people to the already-derived general solutions.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60135</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60135</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 24 Nov 2020 23:58:13 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Wed, 25 Nov 2020 00:41:15 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: Anthony-Noriega">@<bdi>Anthony-Noriega</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I know, I’m a bit <strong>late</strong> :-) Here is my solution !</p>
<p dir="auto">Assuming that the <strong>exact</strong> syntax is :</p>
<pre><code class="language-diff">/.*keyword.*/
</code></pre>
<p dir="auto">SEARCH <strong><code>(?s).+?/\.\*(.+?)\.\*/|.+</code></strong></p>
<p dir="auto">REPLACE <strong><code>?1\1\r\n</code></strong></p>
<p dir="auto">Notes :</p>
<ul>
<li>
<p dir="auto">First, the <strong><code>(?s)</code></strong> syntax means that the <strong>regex</strong> <strong><code>.</code></strong> char will match <strong>any single</strong> character, even an <strong><code>EOL</code></strong> one</p>
</li>
<li>
<p dir="auto">Then , in <strong>two</strong> parts of the search expression, the regex syntax <strong><code>.+?</code></strong> represents the <strong>shortest non-null</strong> range of characters till, <strong>either</strong>, the strings <strong><code>/.*</code></strong> or <strong><code>.*/</code></strong></p>
</li>
<li>
<p dir="auto">Because of the <strong>regex</strong> symbols <strong><code>*</code></strong> and <strong><code>.</code></strong>, these characters must be <strong>escaped</strong> with an <strong>slash</strong>, so the form <strong><code>\.\*</code></strong></p>
</li>
<li>
<p dir="auto">As the <strong>second</strong> <strong><code>.+?</code></strong> syntax is <strong>embedded</strong> between <strong>parentheses</strong>, the <strong>second</strong> range of chars ( each <strong>keyword</strong> ) is stored as <strong>group <code>1</code></strong></p>
</li>
<li>
<p dir="auto">Finally , then <strong>no more</strong> keyword exists, the <strong>second</strong> alternative <strong><code>.+</code></strong> looks for the <strong>greatest non-null</strong> range of characters till… the <strong>very end</strong> of file</p>
</li>
<li>
<p dir="auto">In replacement, the <strong>conditional</strong> structure <strong><code>?1\1\r\n</code></strong> means that if the <strong>group <code>1</code></strong> exists, it is rewritten <strong><code>\1</code></strong>, followed with a <strong>line break</strong> <strong><code>\r\n</code></strong>. When the <strong>second</strong> alternative of the search occurs, <strong>no</strong> group is involved. So nothing occurs, and the <strong>last</strong> range of text, after the <strong>last</strong> keyword, is simply <strong>deleted</strong></p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60132</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60132</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 25 Nov 2020 00:41:15 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 20:30:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: Anthony-Noriega">@<bdi>Anthony-Noriega</bdi></a> said in <a href="/post/60105">Find and remove everything else</a>:</p>
<blockquote>
<p dir="auto">look like a bonehead.</p>
</blockquote>
<p dir="auto">No worries.<br />
We see that kind of thing CONSTANTLY here!<br />
:-)<br />
The important part is we are marking your problem <em><strong>SOLVED</strong></em>!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60106</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60106</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 20:30:56 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 20:28:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> Rookie mistake… i didnt realize the formatter was gonna make me look like a bonehead.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60105</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60105</guid><dc:creator><![CDATA[Anthony Noriega]]></dc:creator><pubDate>Mon, 23 Nov 2020 20:28:58 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 18:57:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: Anthony-Noriega">@<bdi>Anthony-Noriega</bdi></a> said in <a href="/post/60097">Find and remove everything else</a>:</p>
<blockquote>
<p dir="auto">Close, but the pattern you have is off…</p>
</blockquote>
<p dir="auto">Yes, my bad on that.  :-(</p>
<p dir="auto">Too bad we couldn’t have seen this from the very beginning:<br />
<img src="https://i.imgur.com/iUCBskS.png" alt="Imgur" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/60100</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60100</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 18:57:50 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 18:49:37 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 in <a href="/post/60098">Find and remove everything else</a>:</p>
<blockquote>
<p dir="auto">(?s)\G/.*([^.]+).*/|.+?(?=\z|/.*)<br />
That fixed it, thank you all for your help.</p>
</blockquote>
]]></description><link>https://community.notepad-plus-plus.org/post/60099</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60099</guid><dc:creator><![CDATA[Anthony Noriega]]></dc:creator><pubDate>Mon, 23 Nov 2020 18:49:37 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 18:46:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: Anthony-Noriega">@<bdi>Anthony-Noriega</bdi></a> said in <a href="/post/60097">Find and remove everything else</a>:</p>
<blockquote>
<p dir="auto">Close, but the pattern you have is off…on the end</p>
</blockquote>
<p dir="auto">My solution was:<br />
Find What:<code>(?s)\G/\.\*([^.]+)\.\*/|.+?(?=\z|/\.\*)</code><br />
Replace With:<code>?1\1\r\n</code><br />
again a regular expression so search mode is regular expression.</p>
<p dir="auto">Where (again) leaning toothpicks are all around.</p>
<p dir="auto">Cheers<br />
Terry</p>
<p dir="auto">PS I should add there will likely be a last empty line, just a side effect of how the regex works. Should be easy enough to remove that afterwards.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60098</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60098</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 23 Nov 2020 18:46:45 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 18:40:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/60096">Find and remove everything else</a>:</p>
<blockquote>
<p dir="auto">?1${1}\r\n</p>
</blockquote>
<p dir="auto">Close, but the pattern you have is off…on the end, you hvae the star next to the keyword, and it should be the dot as my example.</p>
<pre><code>/.*mykeyword*./
</code></pre>
<p dir="auto">It should be:</p>
<pre><code>/.*mykeyword.*/
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/60097</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60097</guid><dc:creator><![CDATA[Anthony Noriega]]></dc:creator><pubDate>Mon, 23 Nov 2020 18:40:35 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 18:31:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: Anthony-Noriega">@<bdi>Anthony-Noriega</bdi></a></p>
<p dir="auto">Well, it really is a bit tricky.  :-)</p>
<p dir="auto">If we change my earlier text to this (which is more of what I think you have):</p>
<pre><code class="language-z">After a weekend of emotional honesty at an Esalen-style retreat, Los Angeles
sophisticates /.*Bob*./ and /.*Carol*./ Sanders (Robert Culp and Natalie Wood) return
home determined to embrace complete openness. They share their enthusiasm
and excitement over their new-found philosophy with their more conservative
friends Ted and Alice Henderson (/.*Elliott*./ Gould and Dyan Cannon), who remain
doubtful. Soon after, filmmaker Bob has an affair with a young production
assistant on a film shoot in San Francisco. When he gets home he admits his
liaison to Carol, describing the event as a purely physical act, not an
emotional one. To Bob's surprise, Carol is completely accepting of his
extramarital behavior. Later, Carol gleefully reveals the affair to /.*Ted*./ and
/.*Alice*./ as they are leaving a dinner party. Disturbed by Bob's infidelity and
Carol's candor, Alice becomes physically ill on the drive home. She and Ted
have a difficult time coping with the news in bed that night. But as time
passes they grow to accept that Bob and Carol really are fine with the
affair. Later, Ted admits to Bob that he was tempted to have an affair once,
but didn't go through with it; Bob tells Ted he should, rationalizing:
"You've got the guilt anyway. /.*Don't waste it*./."
</code></pre>
<p dir="auto">If we then try this replacement:</p>
<p dir="auto"><strong>find:</strong> <code>(?s).*?/\Q.*\E((?-s).*?)\Q*.\E/|(?s).*\z</code><br />
<strong>repl:</strong> <code>?1${1}\r\n</code><br />
(regular expression search mode)</p>
<p dir="auto">We’ll (again) obtain:</p>
<pre><code class="language-z">Bob
Carol
Elliott
Ted
Alice
Don't waste it
</code></pre>
<p dir="auto">I used the <code>\Q</code> and <code>\E</code> constructs to avoid leaning-toothpick-syndrome, somewhat.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60096</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60096</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 18:31:55 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 18:19:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: Anthony-Noriega">@<bdi>Anthony-Noriega</bdi></a></p>
<p dir="auto">So I’ll show it because you apparently can’t:</p>
<p dir="auto"><code>/.*mykeyword*./</code></p>
<p dir="auto">:-)</p>
<p dir="auto">Please confirm that is correct.<br />
Can you make the adjustments to what I’ve already shown as an example, to make it work?<br />
It might be tricky…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60095</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60095</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 18:19:22 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Mon, 23 Nov 2020 18:14:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> You were correct, the asterisk/star was consumed by the formatter. The pattern is: slash dot star exampleKeyword dot star slash<br />
Essentially I only want the keyword in between that pattern and delete everything else.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60094</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60094</guid><dc:creator><![CDATA[Anthony Noriega]]></dc:creator><pubDate>Mon, 23 Nov 2020 18:14:28 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Thu, 19 Nov 2020 19:02:38 GMT]]></title><description><![CDATA[<p dir="auto">I’m not one for guessing at people’s problem statement, but to show the general technique, let’s say that the data you want to keep is inside pairs of <code>/</code>.</p>
<p dir="auto">So, some data:</p>
<pre><code class="language-z">After a weekend of emotional honesty at an Esalen-style retreat, Los Angeles
sophisticates /Bob/ and /Carol/ Sanders (Robert Culp and Natalie Wood) return
home determined to embrace complete openness. They share their enthusiasm
and excitement over their new-found philosophy with their more conservative
friends Ted and Alice Henderson (/Elliott/ Gould and Dyan Cannon), who remain
doubtful. Soon after, filmmaker Bob has an affair with a young production
assistant on a film shoot in San Francisco. When he gets home he admits his
liaison to Carol, describing the event as a purely physical act, not an
emotional one. To Bob's surprise, Carol is completely accepting of his
extramarital behavior. Later, Carol gleefully reveals the affair to /Ted/ and
/Alice/ as they are leaving a dinner party. Disturbed by Bob's infidelity and
Carol's candor, Alice becomes physically ill on the drive home. She and Ted
have a difficult time coping with the news in bed that night. But as time
passes they grow to accept that Bob and Carol really are fine with the
affair. Later, Ted admits to Bob that he was tempted to have an affair once,
but didn't go through with it; Bob tells Ted he should, rationalizing:
"You've got the guilt anyway. /Don't waste it/."
</code></pre>
<p dir="auto">and a replacement,</p>
<p dir="auto">find: <code>(?s).*?/(?-s)(.*?)/|(?s).*\z</code><br />
repl: <code>?1${1}\r\n</code><br />
(regular expression search mode)</p>
<p dir="auto">will yield:</p>
<pre><code class="language-z">Bob
Carol
Elliott
Ted
Alice
Don't waste it
</code></pre>
<p dir="auto">This technique has its roots in <a href="https://community.notepad-plus-plus.org/topic/12710/marked-text-manipulation">THIS THREAD</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59877</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59877</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 19 Nov 2020 19:02:38 GMT</pubDate></item><item><title><![CDATA[Reply to Find and remove everything else on Thu, 19 Nov 2020 18:36:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/anthony-noriega" aria-label="Profile: Anthony-Noriega">@<bdi>Anthony-Noriega</bdi></a></p>
<p dir="auto">There’s probably a way to do what you need, but your need isn’t very clear.  I see “italics” in your data which means that you’ve probably used a <code>*</code> in composing your post, but it was consumed by the site thinking that it was markup.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59874</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59874</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 19 Nov 2020 18:36:58 GMT</pubDate></item></channel></rss>