title: C# String Pattern Matching
body: <p>I have 2 lists of strings in C# showing the players who have joined and left a particular game. I'm trying to attempt to determine who is still in the game by matching both lists and eliminating the entries of those who have left the game. Please suggest a easy and pain free algorithm to go about doing this. My current code is as follows</p>
  
  <pre><code>string input = inputTextBox.Text;
          string[] lines = input.Split(new string[] {"\r\n", "\n"}, StringSplitOptions.None);
          List&lt;string&gt; filteredinput = new List&lt;string&gt;();
          List&lt;string&gt; joinedlog = new List&lt;string&gt;();
          List&lt;string&gt; leftlog = new List&lt;string&gt;();
  
          for (int i = 0; i&lt;lines.Length; i++)
          {
              if (lines[i].Contains("your game!"))
              filteredinput.Add(lines[i]);
          }
  
          for (int i =0; i&lt;filteredinput.Count; i++)
          {
              if (filteredinput[i].Contains("joined"))
                  joinedlog.Add(filteredinput[i]);
  
              else if (filteredinput[i].Contains("left"))
                  leftlog.Add(filteredinput[i]);
  
          }
  </code></pre>
  
  <p>Here is some sample input : </p>
  
  <pre><code>{SheIsSoScrewed}[Ping:|]  has joined your game!.
  {AngeLa_Yoyo}[Ping:X]  has joined your game!.
  {SheIsSoScrewed}  has left your game!(4).
  </code></pre>