title: C#: finding instances of a string within a string
body: <p>Suppose I had the string "1 AND 2 AND 3 OR 4", and want to create an array of strings that contains all substrings "AND" or "OR", in order, found within the string.</p>
  
  <p>So the above string would return a string array of {"AND", "AND", "OR"}.</p>
  
  <p>What would be a smart way of writing that?</p>
  
  <p>EDIT:
  Using C# 2.0+,</p>
  
  <pre><code>string rule = "1 AND 2 AND 3 OR 4";
  string pattern = "(AND|OR)";
  string[] conditions = Regex.Split(rule, pattern);
  </code></pre>
  
  <p>gives me {"1", "AND", "2", "AND", "3", "OR", "4"}, which isn't quite what I'm after. How can I reduce that to the ANDs and ORs only?</p>