<?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[Remove everything outside of string including string]]></title><description><![CDATA[<p dir="auto">Hi All,</p>
<p dir="auto">I would like to remove:</p>
<ul>
<li>everything outside a string (eg. &lt;Word&gt;);</li>
<li>the string itself;</li>
</ul>
<p dir="auto">And keep only the phrase that was between the string.</p>
<p dir="auto">See below:</p>
<p dir="auto">Source data:<br />
Lorem ipsum dolor sit amet, &lt;Word&gt;consectetur&lt;/Word&gt; adipiscing elit. In non porta nulla. Praesent auctor tellus sit amet libero auctor interdum. Morbi pulvinar, lorem vel volutpat scelerisque, orci magna rhoncus est, tempus &lt;Word&gt;sollicitudin&lt;/Word&gt; metus ligula vitae eros. Phasellus ultricies blandit &lt;Word&gt;felis nec&lt;/Word&gt; malesuada. Nulla quis neque efficitur, suscipit lacus vitae, ornare massa. &lt;Word&gt;Proin&lt;/Word&gt; at blandit enim, nec vulputate leo. Aliquam sed nisl in &lt;Word&gt;nibh placerat&lt;/Word&gt; fringilla.</p>
<p dir="auto">Resultant:<br />
consectetur<br />
sollicitudin<br />
felis nec<br />
Proin<br />
nibh placerat</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/14820/remove-everything-outside-of-string-including-string</link><generator>RSS for Node</generator><lastBuildDate>Sun, 14 Jun 2026 22:30:17 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/14820.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 23 Nov 2017 14:00:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Remove everything outside of string including string on Fri, 04 Jun 2021 11:28:51 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’m guessing you don’t check it very often (hence this posting), but I just sent you an email (to your gmail account) regarding this thread with a “new” technique in it; if it works out as an approach (let me know what you think), we’ll share it here.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28286</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28286</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 04 Jun 2021 11:28:51 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 21:36:00 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> , <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> :</p>
<p dir="auto">I agree that unless a poster specifically says “I must have ‘____’ functionality in ONE (regex) operation” , then good multi-step solutions are perfectly viable.  Especially if it keeps a regex step much more readable.  Some might argue that if they have to do a bunch of individual steps constantly, it gets annoying–to those I’d say that is what the macro recording and playback feature is for.  :-)</p>
<p dir="auto">Side note:  If the trim command I used earlier also does tab characters (and it does), shouldn’t it be called “Trim Trailing Whitespace”?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28277</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28277</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sun, 26 Nov 2017 21:36:00 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 19:55:00 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/colonialboy" aria-label="Profile: colonialboy">@<bdi>colonialboy</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> and <strong>All</strong></p>
<p dir="auto"><strong>Alan</strong>, you’re a <strong>thousand</strong> right, on that matter. I didn’t even try the <strong>Scott</strong>’s regex and I <strong>wrongly</strong> presumed that lines <strong>without</strong> any <strong><code>&lt;Word&gt;...&lt;/Word&gt;</code></strong> were  <strong>not</strong> replaced by a simple <strong>line-break</strong> !</p>
<p dir="auto">So, I apologize and, of course, the <strong>Scott</strong> regex is must more <strong>elegant</strong>, despite of the supplementary but <strong>easy trimming</strong> operation !</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28275</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28275</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 26 Nov 2017 19:55:00 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 18:42:50 GMT]]></title><description><![CDATA[<p dir="auto">I reserve downvoting for rudeness, but isn’t this solution way more complicated than it needs to be?  The earlier solution proposed seemed to work (I guess) and it was accepted by the OP.  So what’s the point in coming up with a more complicated Reg. Exp. solution?  What do I miss?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28272</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28272</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 26 Nov 2017 18:42:50 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 19:59:11 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/colonialboy" aria-label="Profile: colonialboy">@<bdi>colonialboy</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a>, and <strong>All</strong></p>
<p dir="auto"><strong>UPDATE</strong> : Please, do <strong>not</strong> take in account the <strong>S/R</strong> explained in this post and see my <strong>next</strong> post :-)</p>
<p dir="auto">Ah, OK ! Now, I clearly see the goal :-))</p>
<p dir="auto">So you could use the following S/R regex :</p>
<p dir="auto">SEARCH <strong><code>(?-is).*?&lt;Word&gt;(.*?)&lt;/Word&gt;(?=.*&lt;Word&gt;)|.*?&lt;Word&gt;(.*?)&lt;/Word&gt;.*\R?|.*\R?</code></strong></p>
<p dir="auto">REPLACE <strong><code>\1\2?1\t:\r\n</code></strong></p>
<p dir="auto">Then, after a click on the <strong>Replace All</strong> button, your <strong>source</strong> text, below :</p>
<pre><code class="language-diff">Lorem &lt;Word&gt;ipsum&lt;/Word&gt; dolor sit amet, consectetuer &lt;Word&gt;adipiscing&lt;/Word&gt; elit.
Aenean&lt;Word&gt;comodo&lt;/Word&gt; ligura eget dolor.
Aenean massa.
Cum sociis &lt;Word&gt;natoque&lt;/Word&gt;penatibus et magnis&lt;Word&gt;dis&lt;/Word&gt;parturient&lt;Word&gt;montes&lt;/Word&gt; nascetur ridiculus mus.
Dinec quam felis &lt;Word&gt;ultricies&lt;/Word&gt; nec, pellentesque eu, pretium quis, sem.
Nulla consequat massa quis enim.
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, &lt;Word&gt;rhoncus&lt;/Word&gt; ut, imperdiet a, venetatis vitae, justo.
Nulam dictum felis eu pede mollis pretium. Integer tincidunt.
Cras dapibus.
Vivamus elementum &lt;Word&gt;semper&lt;/Word&gt; &lt;Word&gt;nisi&lt;/Word&gt;
Aenean vulputate eleifend tellus.
Aenean leo ligula, porttitor eu, consequat vitae,&lt;Word&gt;eleifend&lt;/Word&gt; ac, enim.
Aliquam lorem ante, &lt;Word&gt;dapibus&lt;/Word&gt; in, viverra quis, feugiat a, tellus.
</code></pre>
<p dir="auto">will be changed, at once, into :</p>
<pre><code class="language-diff">ipsum	adipiscing
comodo

natoque	dis	montes
ultricies


rhoncus


semper	nisi

eleifend
dapibus
</code></pre>
<p dir="auto">Nice, isn’t it ?</p>
<hr />
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">To begin, the <strong><code>(?-is)</code></strong> <strong>modifiers</strong> ensure that :</p>
<ul>
<li>
<p dir="auto">The <strong>dot</strong> ( <strong><code>.</code></strong> ) meta-character will match <strong>standard</strong> characters, only</p>
</li>
<li>
<p dir="auto">The search will be processed, in a <strong>non-insensitive</strong> way. So, the string <strong>&lt;WORD&gt;</strong>, for instance, would <strong>not</strong> be considered as a tag !</p>
</li>
</ul>
</li>
<li>
<p dir="auto">Then the <strong>search</strong> regex is made of <strong>three</strong> alternatives :</p>
<ul>
<li>
<p dir="auto">The <strong>first</strong> part <strong><code>.*?&lt;Word&gt;(.*?)&lt;/Word&gt;(?=.*&lt;Word&gt;)</code></strong> looks for anything, even <strong>nothing</strong>, followed by a <strong><code>&lt;Word&gt;(...)&lt;/Word&gt;</code></strong> block ( with its contents, possibly <strong>null</strong>, stored in <strong>group 1</strong> ) if, further on, an other tag <strong>&lt;Word&gt;</strong> can be found, on the <strong>same</strong> line</p>
</li>
<li>
<p dir="auto">The <strong>second</strong> part <strong><code>.*?&lt;Word&gt;(.*?)&lt;/Word&gt;.*\R?</code></strong> looks for anything, even <strong>nothing</strong>, followed by a <strong><code>&lt;Word&gt;(...)&lt;/Word&gt;</code></strong>  block ( with its contents,possibly <strong>null</strong>, stored in <strong>group 2</strong> ) <strong>without</strong> any other tag <strong>&lt;Word&gt;</strong>, further on, in the <strong>same</strong> line</p>
</li>
<li>
<p dir="auto">The <strong>last</strong> part <strong><code>.*\R?</code></strong>	looks for <strong>any</strong> kind of line, even <strong>empty</strong>, as this line does <strong>not</strong> match the <strong>first</strong> nor the <strong>second</strong> alternative</p>
</li>
</ul>
</li>
<li>
<p dir="auto">In <strong>replacement</strong> :</p>
<ul>
<li>
<p dir="auto"><strong>First</strong>, the groups <strong>1</strong> and <strong>2</strong>, standing for the <strong>range</strong> of chars between the two tags <strong><code>&lt;Word&gt;</code></strong> and <strong><code>&lt;/Word&gt;</code></strong>, and which are <strong>mutually exclusive</strong>, are just rewritten ( These <strong>two</strong> groups <strong>cannot</strong> be <strong>non null</strong>, at the <strong>same</strong> time ! )</p>
</li>
<li>
<p dir="auto">Then, if <strong>group 1</strong> exits, we write a <strong>tabulation</strong> character. In <strong>all other</strong> cases , we do <strong>not</strong> rewrite any text but simply write a <strong>line break</strong> ( <strong><code>\r\n</code></strong> ) ( or  <strong><code>\n</code></strong> for <strong>Unix</strong> files ).</p>
</li>
<li>
<p dir="auto">Note that the <strong>full</strong> syntax, of this <strong>conditional</strong> replacement, is <strong><code>(?1\t:\r\n)</code></strong>, with the <strong>colon</strong> standing for the <strong>limit</strong> between the case <strong>THEN</strong> ( when <strong>group1</strong> exists ) and the case <strong>ELSE</strong> !</p>
</li>
</ul>
</li>
</ul>
<hr />
<p dir="auto"><strong>Remarks</strong> :</p>
<ul>
<li>
<p dir="auto">Any line, even <strong>empty</strong>, which does <strong>not</strong> contain any block <strong><code>&lt;Word&gt;(...)&lt;/Word&gt;</code></strong> block, is simply replaced with a <strong>line break</strong></p>
</li>
<li>
<p dir="auto">Any <strong>empty</strong> block <strong><code>&lt;Word&gt;&lt;/Word&gt;</code></strong> is replaced with :</p>
<ul>
<li>
<p dir="auto">A <strong>tabulation</strong> character, if <strong>other</strong> blocks <strong><code>&lt;Word&gt;...&lt;/Word&gt;</code></strong> exist, on the <strong>same</strong> line</p>
</li>
<li>
<p dir="auto">A <strong>line break</strong>, if <strong>no</strong> other block <strong><code>&lt;Word&gt;...&lt;/Word&gt;</code></strong> exist, on the <strong>same</strong> line</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">Why, can you simply use the symbols <strong><code>&lt;</code></strong> and <strong><code>&gt;</code></strong> to <strong>delimit</strong> the ranges of characters to <strong>keep</strong> ? Of course, this implies that these characters are <strong>not</strong> part of your <strong>initial</strong> text !</p>
<p dir="auto">Thus, the <strong>search</strong> regex would become <strong><code>(?-s).*?&lt;(.*?)&gt;(?=.*&lt;)|.*?&lt;(.*?)&gt;.*\R?|.*\R?</code></strong>. This should work, although <strong>not</strong> tested yet !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28269</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28269</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 26 Nov 2017 19:59:11 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 15:05:42 GMT]]></title><description><![CDATA[<p dir="auto">thank you again @Scott Sumner. I will for sure learn from this and also I hope it provides others too with some help. This is particularly helpful for those that work with <a href="en.wikipedia.org/wiki/Named-entity_recognition">“Named entity recognition”</a>!</p>
<p dir="auto">For convenience here are the two images previously link. @Scott Sumner was able to provide the conversion from this:<br />
<strong>Source Text</strong></p>
<p dir="auto"><img src="https://camo.nodebb.org/8f106d81efbe98419d60ce189bd0a95417af863b?url=https%3A%2F%2Fi.imgur.com%2Fk5xxmgz.png" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">to this:</p>
<p dir="auto"><strong>Resultant</strong></p>
<p dir="auto"><img src="https://camo.nodebb.org/4945c5a62fec9fb2380f64184f99da92ffc9ad05?url=https%3A%2F%2Fi.imgur.com%2FgxsG8RS.png" alt="" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/28266</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28266</guid><dc:creator><![CDATA[colonialboy]]></dc:creator><pubDate>Sun, 26 Nov 2017 15:05:42 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 13:39:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/colonialboy" aria-label="Profile: colonialboy">@<bdi>colonialboy</bdi></a></p>
<p dir="auto">Here’s how I would attack your revised need (aside from advising you to experiment on your own with the solutions originally provided…so you learn)–it is just a simplification of the original solution:</p>
<p dir="auto"><strong>Find-what</strong> zone: <code>(?:.*?&lt;Word&gt;(.+?)&lt;/Word&gt;)|.+</code><br />
<strong>Replace-with</strong> zone: <code>?1\1\t</code><br />
Post-replace action:  <strong>Edit</strong> (menu) -&gt; <strong>Blank Operations</strong> -&gt; <strong>Trim Trailing Space</strong></p>
<p dir="auto">The only real difference between this and the earlier is the removal of the leading <code>(?s)</code> from the FW part (to keep line-breaks intact), and the substitution of <code>\t</code> for <code>\r\n</code> in the RW part (to put tab characters in between “Words” occurring on the same line).  Putting the tab character in results in a trailing tab character on each line with one or more "Word"s, which the “Trim Trailing Space” action removes.</p>
<p dir="auto">BTW, inline images may be done as follows:</p>
<p dir="auto"><code>![](https://i.imgur.com/gxsG8RS.png)</code></p>
<p dir="auto">will embed as:</p>
<p dir="auto"><img src="https://camo.nodebb.org/4945c5a62fec9fb2380f64184f99da92ffc9ad05?url=https%3A%2F%2Fi.imgur.com%2FgxsG8RS.png" alt="" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/28263</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28263</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sun, 26 Nov 2017 13:39:55 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 13:13:47 GMT]]></title><description><![CDATA[<p dir="auto">Or at the very least to preserve the line breaks would be fine</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28262</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28262</guid><dc:creator><![CDATA[colonialboy]]></dc:creator><pubDate>Sun, 26 Nov 2017 13:13:47 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Sun, 26 Nov 2017 12:49:45 GMT]]></title><description><![CDATA[<p dir="auto">Thanks to @Scott Sumner, and <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> for your great answers. Just to push this a little further: my ultimate aim is to put all this info into a spreadsheet. My data looks something like this:</p>
<p dir="auto"><a href="https://i.imgur.com/k5xxmgz.png" rel="nofollow ugc">Source’Text</a></p>
<p dir="auto">And I am looking for locations in book titles - in this case each line is a book titie and each location is contained within &lt;Word&gt;&lt;/Word&gt;.<br />
I would like to preserve the line breaks even when some lines don’t contain &lt;Word&gt;. Also if a line contains two or more instances of &lt;Word&gt;&lt;/Word&gt; , then I would like to place a tab between them for translating it to another column in a spreadsheet. Something like the following:</p>
<p dir="auto"><a href="https://i.imgur.com/gxsG8RS.png" rel="nofollow ugc">Resultant</a></p>
<p dir="auto">Many thanks again,</p>
<p dir="auto">colonialboy</p>
<p dir="auto">*apologies, i’m not sure how to show images inline.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28261</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28261</guid><dc:creator><![CDATA[colonialboy]]></dc:creator><pubDate>Sun, 26 Nov 2017 12:49:45 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Fri, 24 Nov 2017 00:15:12 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">Nice regex simplification, although I would leave in the <code>?1</code> in the replace part so that the extra line-ending isn’t added.  :-D<br />
And good point about the *nix line endings–sure would be nice if there was a syntax for simply a “line-ending” and it would do the right thing, but I understand and appreciate why you can use <code>\R</code> in the <strong>Find what</strong> zone but not in the <strong>Replace with</strong> zone.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/colonialboy" aria-label="Profile: colonialboy">@<bdi>colonialboy</bdi></a></p>
<p dir="auto">Rather than trying to select (for deletion) text that isn’t what you want to have, I like the technique discussed <a href="https://notepad-plus-plus.org/community/topic/12710/marked-text-manipulation/26" rel="nofollow ugc">here</a> which provides a method to copy out the text you <em><strong>are</strong></em> interested in (although it takes an additional plugin+script to do it).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28215</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28215</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 24 Nov 2017 00:15:12 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Thu, 23 Nov 2017 21:04:44 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/colonialboy" aria-label="Profile: colonialboy">@<bdi>colonialboy</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a>, and <strong>All</strong>,</p>
<p dir="auto">I think that the <strong>simple</strong> regex S/R, below, should do the job, nicely :-))</p>
<p dir="auto">SEARCH <strong><code>(?s).+?&lt;Word&gt;(.+?)&lt;/Word&gt;|.+</code></strong></p>
<p dir="auto">REPLACE <strong><code>\1\r\n</code></strong></p>
<p dir="auto">OPTIONS <strong><code>Wrap around</code></strong> and <strong><code>Regular expression</code></strong> <strong>set</strong>, only</p>
<p dir="auto">Of course, <strong>all</strong> the text, at the <strong>end</strong> of the file, after the <strong>last</strong> <strong><code>&lt;/Word&gt;</code></strong> boundary is replaced by a <strong>single</strong> line-break.</p>
<p dir="auto">In theory, I should have used, in <strong>replacement</strong>,  the <strong>Scott</strong>’s syntax : <strong><code>?1\1\r\n</code></strong> Note that the enclosing <strong>parentheses</strong> are useless, as all the <strong>replace</strong> regex depends on the existence of <strong>group 1</strong>, only. Just my <strong>laziness</strong> moment  !</p>
<p dir="auto">Also, <strong>colonialboy</strong>, if you deal with <strong>Unix</strong> files, just change, in <strong>replacement</strong>, the <strong><code>\r\n</code></strong> syntax by <strong><code>\n</code></strong></p>
<p dir="auto">So from your <strong>initial</strong> text, that I split on <strong>several</strong> lines :</p>
<pre><code class="language-diff">Lorem ipsum

 dolor sit amet, &lt;Word&gt;consectetur&lt;/Word&gt; adipiscing
 elit. In non porta nulla. Praesent auctor tellus sit amet libero 
 
 auctor interdum. Morbi pulvinar, lorem vel volutpat scelerisque, orci magna rhoncus est, tempus &lt;Word&gt;sollicitudin&lt;/Word&gt;

 metus ligula vitae eros. Phasellus


 ultricies blandit &lt;Word&gt;felis nec&lt;/Word&gt; malesuada. Nulla quis neque efficitur, suscipit lacus vitae,
 ornare massa. &lt;Word&gt;Proin&lt;/Word&gt; at blandit enim, nec vulputate leo. 
 Aliquam sed nisl in &lt;Word&gt;nibh placerat&lt;/Word&gt;
</code></pre>
<p dir="auto">This <strong>S/R</strong> would get, after a click on the <strong>Replace All</strong> button, the text :</p>
<pre><code class="language-diff">consectetur
sollicitudin
felis nec
Proin
nibh placerat

</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28212</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28212</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 23 Nov 2017 21:04:44 GMT</pubDate></item><item><title><![CDATA[Reply to Remove everything outside of string including string on Thu, 23 Nov 2017 15:56:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/colonialboy" aria-label="Profile: colonialboy">@<bdi>colonialboy</bdi></a></p>
<p dir="auto">Hmmm.  Maybe unnecessarily complicated, but this seems to work to meet the spec:</p>
<p dir="auto"><strong>Find-what</strong> zone:  <code>(?s)(?:.*?&lt;Word&gt;(.+?)&lt;/Word&gt;)|(?!.+?&lt;Word&gt;).+</code><br />
<strong>Replace-with</strong> zone:  <code>(?1\1\r\n)</code><br />
<strong>Search mode</strong>:  Regular expression</p>
<p dir="auto">What it does is match a string of any characters followed by &lt;Word&gt; followed by a string of characters followed by &lt;/Word&gt;.  When that matches, it is replaced by what was remembered as group 1 occurring between the delimiters.</p>
<p dir="auto">The trouble comes from the extra text at the end of the string (after the last set of delimiters)–so we turn the whole thing into an alternation (using <code>|</code>) and assert that no more opening delimiters occur and we gobble up the remaining text this way.  Replacement is only done if group 1 exists, meaning that the match occurred on the left side of the alternation (i.e. valid delimited word rather than just a remaining text gobble).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28207</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28207</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Thu, 23 Nov 2017 15:56:59 GMT</pubDate></item></channel></rss>