<?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 for 2 strings with AND not OR]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I like to search files and find all files that contain line that have "def " AND “phone”.</p>
<p dir="auto">I tried searching using def |phone and I get all results where "def " or “phone are found”. I need only results where both exist on a line.</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19079/search-for-2-strings-with-and-not-or</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 19:50:47 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19079.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Mar 2020 12:41:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Search for 2 strings with AND not OR on Sun, 22 Mar 2020 12:55:44 GMT]]></title><description><![CDATA[<p dir="auto">My bad.  I should have stated the original search like this, I suppose:</p>
<p dir="auto"><em><strong>Find what</strong></em> box: <code>(?-s)^(?=.*def)(?=.*phone).+</code><br />
<em><strong>Match case</strong></em> checkbox: <strong>unticked</strong> or <strong>ticked</strong> &lt;------ as you need</p>
<p dir="auto">Not everyone knows that:</p>
<ul>
<li>leading off your regex with a variant of <code>(?i)</code> will search case INSENSITIVELY (the <code>i</code> is for Insensitive)</li>
<li>leading off your regex with a variant of <code>(?-i)</code> will search case SENSITIVELY (the <code>-i</code> is for NOT [or “minus”] Insensive)</li>
</ul>
<p dir="auto">and that these little strings, if used, override the setting of the <em><strong>Match case</strong></em> checkbox, since they are logically processed <em>after</em> the checkbox setting.</p>
<p dir="auto">However, the misunderstanding could have been avoided had some sample data been provided along with the original question.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51587</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51587</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 22 Mar 2020 12:55:44 GMT</pubDate></item><item><title><![CDATA[Reply to Search for 2 strings with AND not OR on Sat, 21 Mar 2020 16:58:17 GMT]]></title><description><![CDATA[<p dir="auto">HTH,</p>
<p dir="auto">Ahhhh, yes, that did the trick!</p>
<p dir="auto">Thanks to you and Alan for the help.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51562</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51562</guid><dc:creator><![CDATA[John Currey]]></dc:creator><pubDate>Sat, 21 Mar 2020 16:58:17 GMT</pubDate></item><item><title><![CDATA[Reply to Search for 2 strings with AND not OR on Sat, 21 Mar 2020 16:25:53 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/john-currey" aria-label="Profile: John-Currey">@<bdi>John-Currey</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a>, All:</p>
<p dir="auto">I think I understand where is the issue: you are searching in a non-insensitive mode (?-is), that is, in a sensitive way, when the correct mode is an insensitive mode, as (?i-s).</p>
<p dir="auto">HTH</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51561</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51561</guid><dc:creator><![CDATA[astrosofista]]></dc:creator><pubDate>Sat, 21 Mar 2020 16:25:53 GMT</pubDate></item><item><title><![CDATA[Reply to Search for 2 strings with AND not OR on Sat, 21 Mar 2020 15:20:41 GMT]]></title><description><![CDATA[<p dir="auto">Alan,</p>
<p dir="auto">I appreciate your assistance. As you’ll notice, the PHONELIB.WBS file contains both “DEF” and “PHONE” on lines 1 and 22 and is located in my search folder, yet the search string you provided did not find it as you can see from the results. Any thoughts on what I may have done wrong?</p>
<p dir="auto">Thanks.</p>
<p dir="auto"><img src="/assets/uploads/files/1584803835945-06f6e86e-7298-44c5-9288-172cba1ecf5c-image.png" alt="06f6e86e-7298-44c5-9288-172cba1ecf5c-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/51559</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51559</guid><dc:creator><![CDATA[John Currey]]></dc:creator><pubDate>Sat, 21 Mar 2020 15:20:41 GMT</pubDate></item><item><title><![CDATA[Reply to Search for 2 strings with AND not OR on Sat, 21 Mar 2020 14:41:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/john-currey" aria-label="Profile: John-Currey">@<bdi>John-Currey</bdi></a> said in <a href="/post/51556">Search for 2 strings with AND not OR</a>:</p>
<blockquote>
<p dir="auto">I’m looking to search the entire content of the file. I want the results to show any file and any line in that file that contains both strings.</p>
</blockquote>
<p dir="auto">These two things aren’t related to the “and” nature of your desired search.</p>
<blockquote>
<p dir="auto">search the entire content of the file</p>
</blockquote>
<p dir="auto">So use <strong>Find All in Current Document</strong> button to run the search?</p>
<blockquote>
<p dir="auto">show any file and any line in that file</p>
</blockquote>
<p dir="auto">So use <strong>Find All</strong> button on <strong>Find in Files</strong> tab to run the search?</p>
<p dir="auto">Your statements make me believe you don’t really know how to do searching in Notepad++, and go beyond the original question.</p>
<p dir="auto">Anyway, to show that what I provided does indeed work, I took this data:</p>
<pre><code>Alan
Alan Carol
Alan Bob
Carol Alan Bob
Bob
Alice Ted Carol
Ted Carol Alan
Ted Carol Bob
Alice Carol Bob
Ted Carol
Ted Alice
Ted Bob
Alice Alan Bob
Alice
Bob Alan Ted Alice
Bob Carol
Alice Carol Alan
Carol
Alan Ted
Bob Alice
Bob Alice Alan Ted Carol
Bob Carol Ted Alice
Alan Alice
Alice Ted Alan
Ted
Ted Alan Bob
Carol Alan Ted Alice
Bob Carol Alan Alice
Alice Ted Bob
Bob Carol Alan Ted
Carol Alice
</code></pre>
<p dir="auto">And I ran this search on it:</p>
<p dir="auto"><em><strong>Find what</strong></em> box: <code>(?i-s)^(?=.*Bob)(?=.*Alan).+</code><br />
<em><strong>Search mode</strong></em> radiobutton: <em><strong>Regular expression</strong></em><br />
Press the <em><strong>Find All in Current Document</strong></em> button</p>
<p dir="auto">Which is a search for “Bob and Alan on a line, in either order”.</p>
<p dir="auto">And I obtained these results:</p>
<p dir="auto"><img src="/assets/uploads/files/1584801536419-5db4ad99-7a3c-4f64-93d0-1f6f7b50eb29-image.png" alt="5db4ad99-7a3c-4f64-93d0-1f6f7b50eb29-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/51557</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51557</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 21 Mar 2020 14:41:31 GMT</pubDate></item><item><title><![CDATA[Reply to Search for 2 strings with AND not OR on Sat, 21 Mar 2020 14:06:06 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/51552">Search for 2 strings with AND not OR</a>:</p>
<blockquote>
<p dir="auto">(?-is)^(?=.*def)(?=.*phone).+</p>
</blockquote>
<p dir="auto">Hi Alan,</p>
<p dir="auto">Thanks for your response. I’m looking to search the entire content of the file. I want the results to show any file and any line in that file that contains both strings.</p>
<p dir="auto">I tried your suggestion with the radio button set to Regular Expression and only received 2 results. I’m certiain there are more.</p>
<p dir="auto">Thanks again.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51556</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51556</guid><dc:creator><![CDATA[John Currey]]></dc:creator><pubDate>Sat, 21 Mar 2020 14:06:06 GMT</pubDate></item><item><title><![CDATA[Reply to Search for 2 strings with AND not OR on Sat, 21 Mar 2020 13:31:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/john-currey" aria-label="Profile: John-Currey">@<bdi>John-Currey</bdi></a></p>
<p dir="auto">Something like this could do it:</p>
<p dir="auto"><em><strong>Find what</strong></em> box: <code>(?-is)^(?=.*def)(?=.*phone).+</code><br />
<em><strong>Search mode</strong></em> radiobutton: <em><strong>Regular expression</strong></em></p>
<p dir="auto">Note that this works regardless of whether <code>def</code> or <code>phone</code> occurs first on the line.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51552</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51552</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 21 Mar 2020 13:31:53 GMT</pubDate></item></channel></rss>