<?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[Search and select lines containing all keywords in notepad++]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I am looking for a regular expression or any option… that allows me to search and select lines from notepad++, that contain all of the keywords.</p>
<p dir="auto">Eg.<br />
The CAT and the DOG are friends<br />
The CAT is named Purr.<br />
The DOG is named Bark.<br />
It is raining CATs and DOGs.</p>
<p dir="auto">I need to select lines 1 and 4.</p>
<p dir="auto">Please help</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17149/search-and-select-lines-containing-all-keywords-in-notepad</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 18:13:24 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17149.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Feb 2019 17:47:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Search and select lines containing all keywords in notepad++ on Tue, 19 Feb 2019 20:36:39 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <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/maria-nita" aria-label="Profile: maria-nita">@<bdi>maria-nita</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><strong>Alan</strong>, the first answer of this <strong>stackoverflow</strong>’s topic is really the <strong>best</strong> one ;-))</p>
<p dir="auto">Indeed ! At <strong>first</strong> sight, although that, in OP text , word CAT always <strong>precedes</strong> the word DOG, I thought about the <strong>search</strong> regex, below :</p>
<p dir="auto"><strong><code>^.*(CAT).*(DOG).*|^.*(?2).*(?1).*</code></strong></p>
<p dir="auto">However, the syntax <strong><code>^(?=.*CAT)(?=.*DOG).*</code></strong> is really more <strong>elegant</strong> !</p>
<hr />
<p dir="auto">We can <strong>generalize</strong> to <strong>any</strong> number of words and, also, add <strong>conditions</strong> which should <strong>not</strong> occur ;-)) . For instance, the following regex would match <strong>all</strong> lines, with their <strong>line-breaks</strong>, which :</p>
<ul>
<li>
<p dir="auto">Contain the <strong><code>3</code></strong> expressions <strong>WORD_1</strong> AND <strong>WORD_2</strong> AND <strong>WORD_5</strong></p>
</li>
<li>
<p dir="auto">Does <strong>NOT</strong> contain the <strong><code>2</code></strong> expressions <strong>WORD_4</strong> OR <strong>WORD_6</strong></p>
</li>
</ul>
<p dir="auto"><strong><code>(?-s)^(?=.*WORD_1)(?=.*WORD_2)(?=.*WORD_5)(?!.*WORD_4)(?!.*WORD_6).*\R</code></strong></p>
<p dir="auto">So, it matches the lines <strong><code>5</code></strong>, <strong><code>12</code></strong> and <strong><code>14</code></strong>, <strong>only</strong>, in the text :</p>
<pre><code class="language-diff">This line   1  contains   WORD_1  WORD_2
This line   2  contains   WORD_1  WORD_3  WORD_5
This line   3  contains   WORD_3  WORD_5  WORD_4
This line   4  contains   WORD_1  WORD_5
This line   5  contains   WORD_5  WORD_2  WORD_1
This line   6  contains   WORD_2  WORD_1  WORD_6  WORD_5
This line   7  contains   WORD_4  WORD_1  WORD_5
This line   8  contains   WORD_2
This line   9  contains   WORD_5  WORD_2  WORD_4  WORD_7  WORD_1
This line  10  contains   WORD_1  WORD_6  WORD_2
This line  11  contains   WORD_4  WORD_2  WORD_1, WORD_5  WORD_6
This line  12  contains   WORD_7  WORD_2  WORD_5  WORD_1
This line  13  contains   WORD_6  WORD_2  WORD_1  WORD_5
This line  14  contains   WORD_1  WORD_5  WORD_8  WORD_2  WORD_3
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40055</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40055</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 19 Feb 2019 20:36:39 GMT</pubDate></item><item><title><![CDATA[Reply to Search and select lines containing all keywords in notepad++ on Tue, 19 Feb 2019 18:49:14 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><br />
Thanks for the link</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40054</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40054</guid><dc:creator><![CDATA[maria nita]]></dc:creator><pubDate>Tue, 19 Feb 2019 18:49:14 GMT</pubDate></item><item><title><![CDATA[Reply to Search and select lines containing all keywords in notepad++ on Tue, 19 Feb 2019 18:16:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maria-nita" aria-label="Profile: maria-nita">@<bdi>maria-nita</bdi></a></p>
<p dir="auto">Do you know how to use google?</p>
<p dir="auto">If not, then: <a href="https://stackoverflow.com/questions/4389644/regex-to-match-string-containing-two-names-in-any-order" rel="nofollow ugc">https://stackoverflow.com/questions/4389644/regex-to-match-string-containing-two-names-in-any-order</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/40053</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40053</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 19 Feb 2019 18:16:21 GMT</pubDate></item></channel></rss>