<div dir="ltr"><div>Hello,</div><div><br></div><div></div><div>If we want to check if a string contains any/all of several other strings we have to use several or/and conditions or any/all.</div><div><br></div><div>For any:<br></div><div></div><div></div><div></div><div></div><div><div style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;" class="prettyprint"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify"><code class="prettyprint"><span style="color: #008;" class="styled-by-prettify">if ('string1' in master_string or 'string2' in master_string <br>        or 'string3' in master_string):<br></span></code><br>or<br><br></span><span style="color: #008;" class="styled-by-prettify">if</span><span style="color: #000;" class="styled-by-prettify"> any</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #000;" class="styled-by-prettify">item </span><span style="color: #008;" class="styled-by-prettify">in</span><span style="color: #000;" class="styled-by-prettify"> master_string </span><span style="color: #008;" class="styled-by-prettify">for</span><span style="color: #000;" class="styled-by-prettify"> item </span><span style="color: #008;" class="styled-by-prettify">in</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #660;" class="styled-by-prettify">[</span><span style="color: #080;" class="styled-by-prettify">'string1'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string2'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string3'</span><span style="color: #660;" class="styled-by-prettify">]):</span></div></code></div></div><div></div><div><br></div><div>For all:<br></div><div></div><div><div style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;" class="prettyprint"><code class="prettyprint"><div class="subprettyprint"><span style="color: #008;" class="styled-by-prettify"><code class="prettyprint"><span style="color: #000;" class="styled-by-prettify"><code class="prettyprint"><span style="color: #008;" class="styled-by-prettify">if ('string1' in master_string and 'string2' in master_string <br>        and'string3' in master_string):<br><br>or<br><br></span></code></span></code>if</span><span style="color: #000;" class="styled-by-prettify"> all</span><span style="color: #660;" class="styled-by-prettify">(</span><span style="color: #000;" class="styled-by-prettify">item </span><span style="color: #008;" class="styled-by-prettify">in</span><span style="color: #000;" class="styled-by-prettify"> master_string </span><span style="color: #008;" class="styled-by-prettify">for</span><span style="color: #000;" class="styled-by-prettify"> item </span><span style="color: #008;" class="styled-by-prettify">in</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #660;" class="styled-by-prettify">[</span><span style="color: #080;" class="styled-by-prettify">'string1'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string2'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string3'</span><span style="color: #660;" class="styled-by-prettify">]):</span></div></code></div></div><div><br></div><div>I suggest adding some "sugar" to make it more readable by adding contains_any_in and contains_all_in to look like this</div><div><br></div><div>For any:<br></div><div><div><div style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;" class="prettyprint"><code class="prettyprint"><div class="subprettyprint"><span style="color: #008;" class="styled-by-prettify">if</span><span style="color: #000;" class="styled-by-prettify"> master_string contains_any_in </span><span style="color: #660;" class="styled-by-prettify">[</span><span style="color: #080;" class="styled-by-prettify">'string1'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string2'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string3'</span><span style="color: #660;" class="styled-by-prettify">]:</span></div></code></div><br></div><div>For all:<br></div><div></div><div><div style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;" class="prettyprint"><code class="prettyprint"><div class="subprettyprint"><span style="color: #008;" class="styled-by-prettify">if</span><span style="color: #000;" class="styled-by-prettify"> master_string contains_all_in </span><span style="color: #660;" class="styled-by-prettify">[</span><span style="color: #080;" class="styled-by-prettify">'string1'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string2'</span><span style="color: #660;" class="styled-by-prettify">,</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #080;" class="styled-by-prettify">'string3]:</span></div></code></div></div><div><br></div><div><br></div><div>What do you think?</div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>JM</div><div><br></div></div></div>