title: Need help to get IP from strings in c#
body: <p>So I'm working on a little side project in c# and want to read a long text file and when it encounters the line <code>"X-Originating-IP: [192.168.1.1]"</code> I would like to grab the IP and display to console just the recognized IP #, so just <code>192.168.1.1</code> etc. I am having trouble understanding regex. Anyone who could get me started is much appreciated. What I have so far is below.</p>
  
  <pre><code>namespace x.Originating.Ip
  {
      class Program
      {
          static void Main(string[] args)
          {
              int counter = 0;
              string line;
              System.IO.StreamReader file =
                  new System.IO.StreamReader("C:\\example.txt");
  
              while ((line = file.ReadLine()) != null)
              { 
                  if (line.Contains("X-Originating-IP: "))
                  Console.WriteLine(line);
                  counter++;
              }
  
              file.Close();
              Console.ReadLine();
          }
      }
  }
  </code></pre>