title: Regular expression for "$/Folder1/Folder2/Folder3/File.xml"
body: <p>What should my regular expression look like if I want to validate that <code>$/Folder1/Folder2/Folder3/File.xml</code> always starts with <code>$</code> and always ends with <code>xml</code></p>
  
  <pre><code>"$/Folder1/Folder2/Folder3/File.xml"
  Pass
  
  "$/Folder1/Folder2/Folder3/File.xm"
  Fail
  
  "$/Folder1/Folder2/Folder3/File.py"
  Fail
  
  "A/Folder1/Folder2/Folder3/File.xml"
  Fail
  </code></pre>
  
  <p>Edit... So... The right regular expression is...</p>
  
  <pre><code>"^\$.*xml$"
  </code></pre>
  
  <p>The the method after the implementation of the regex checker looks like...</p>
  
  <pre><code>public bool ValidateConfigPath(string config)
      {
          var match = Regex.Match(config, @"^\$.*xml$", RegexOptions.IgnoreCase);
  
          return match.Success;
      }
  </code></pre>
  
  <p>And all my unit tests pass...</p>
  
  <pre><code>[TestMethod]
      public void ValidateConfigPath_InCorrect1()
      {
          var t = new TfsWrapper();
          var isValid = t.ValidateConfigPath("$/Quantz/Main/CSS Calculator/main.py");
          Assert.IsFalse(isValid);
      }
  
      [TestMethod]
      public void ValidateConfigPath_InCorrect2()
      {
          var t = new TfsWrapper();
          var isValid = t.ValidateConfigPath("C:/Quantz/Main/CSS Calculator/main.xml");
          Assert.IsFalse(isValid);
      }
  
      [TestMethod]
      public void ValidateConfigPath_Correct()
      {
          var t = new TfsWrapper();
          var isValid = t.ValidateConfigPath("$/Quantz/Main/CSS Calculator/main.xml");
          Assert.IsTrue(isValid);
      }
  </code></pre>