title: Regex: I want this AND that AND that... in any order
body: <p>I'm not even sure if this is possible or not, but here's what I'd like.</p>
  
  <pre><code>String: "NS306 FEBRUARY 20078/9/201013B1-9-1Low31 AUGUST 19870"
  </code></pre>
  
  <p>I have a text box where I type in the search parameters and they are space delimited.  Because of this, I want to return a match is string1 is in the string and then string2 is in the string, OR string2 is in the string and then string1 is in the string.  I don't care what order the strings are in, but they ALL (will somethings me more than 2) have to be in the string.</p>
  
  <p>So for instance, in the provided string I would want:</p>
  
  <pre><code>"FEB Low"
  </code></pre>
  
  <p>or</p>
  
  <pre><code>"Low FEB"
  </code></pre>
  
  <p>...to return as a match.</p>
  
  <p>I'm REALLY new to regex, only read some tutorials on <a href="http://perldoc.perl.org/perlretut.html" rel="noreferrer">here</a> but that was a while ago and I need to get this done today.  Monday I start a new project which is much more important and can't be distracted with this issue.  Is there anyway to do this with regular expressions, or do I have to iterate through each part of the search filter and permutate the order?  Any and all help is extremely appreciated.  Thanks.</p>
  
  <p>UPDATE:
  The reason I don't want to iterate through a loop and am looking for the best performance wise is because unfortunately, the dataTable I'm using calls this function on every key press, and I don't want it to bog down.</p>
  
  <p>UPDATE:
  Thank you everyone for your help, it was much appreciated.</p>
  
  <p>CODE UPDATE:</p>
  
  <p>Ultimately, this is what I went with.</p>
  
  <pre><code>string sSearch = nvc["sSearch"].ToString().Replace(" ", ")(?=.*");
  if (sSearch != null &amp;&amp; sSearch != "")
  {
    Regex r = new Regex("^(?=.*" + sSearch + ").*$", RegexOptions.IgnoreCase);
    _AdminList = _AdminList.Where&lt;IPB&gt;(
                                         delegate(IPB ipb)
                                         {
                                            //Concatenated all elements of IPB into a string
                                            bool returnValue = r.IsMatch(strTest); //strTest is the concatenated string
                                            return returnValue;
                                      }).ToList&lt;IPB&gt;();
                                         }
  }
  </code></pre>
  
  <p>The IPB class has X number of elements and in no one table throughout the site I'm working on are the columns in the same order.  Therefore, I needed to any order search and I didn't want to have to write a lot of code to do it.  There were other good ideas in here, but I know my boss really likes Regex (preaches them) and therefore I thought it'd be best if I went with that for now.  If for whatever reason the site's performance slips (intranet site) then I'll try another way.  Thanks everyone.</p>