title: Match multiple strings
body: <p>I'm trying to see whether or not 2 strings match. </p>
  
  <pre><code>example: 1234.5678.9012.3456 =&gt; 5678.1234.3456 = match 
  </code></pre>
  
  <p>This matches because the second string of number are also in the first one. I did this with the following code:</p>
  
  <pre><code>&lt;?php
  $haystack =  '1234.5678.9012.3456';
  $needle = '5678.1234.3456';
  $regex = '/(?=.*'. str_replace(".",")(?=.*",$needle) .').*$/'; 
      // regex looks like this /(?=.*5678)(?=.*1234)(?=.*3456).*$/
  
  if(preg_match($regex, $haystack)){
      echo "A match was found.";
  } else {
      echo "A match was not found.";
  }
  ?&gt;
  </code></pre>
  
  <p>Here is my problem, when there are duplicate numbers.</p>
  
  <pre><code>example: 1234.5678.9012.3456 =&gt; 5678.5678.3456 = dont match 
           1234.5678.5678.3456 =&gt; 5678.5678.3456 = match 
  </code></pre>
  
  <p>The first example doesnt match because 5678 occurs twice but the first string only has 5678 once. In the second example 5678 occurs twice as well and therefor matches the second string.</p>
  
  <p>My question: How could I change my regex,    </p>