title: Match regex at exact offset
body: <p>I want to check if a certain pattern (eg. a double quoted string) matches at an exact position.</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>string text = "aaabbb";
  Regex regex = new Regex("b+");
  // Now match regex at exactly char 3 (offset) of text
  </code></pre>
  
  <p>I'd like to check if <code>regex</code> matches at exactly char 3.<br>
  I had a look at the <code>Regex.Match Method (String, Int32)</code> but it does not behave like I expected.<br>
  So I did some tests and some workarounds:</p>
  
  <pre><code>public void RegexTest2()
  {
      Match m;
      string text = "aaabbb";
      int offset = 3;
  
      m = new Regex("^a+").Match(text, 0); // lets do a sanity check first
      Assert.AreEqual(true, m.Success);
      Assert.AreEqual("aaa", m.Value);  // works as expected
  
      m = new Regex("^b+").Match(text, offset);
      Assert.AreEqual(false, m.Success);  // this is quite strange...
  
      m = new Regex("^.{"+offset+"}(b+)").Match(text); // works, but is not very 'nice'
      Assert.AreEqual(true, m.Success);
      Assert.AreEqual("bbb", m.Groups[1].Value);
  
      m = new Regex("^b+").Match(text.Substring(offset)); // works too, but 
      Assert.AreEqual(true, m.Success);
      Assert.AreEqual("bbb", m.Value);
  }
  </code></pre>
  
  <p>In fact I'm starting to believe that <code>new Regex("^.", 1).Match(myString)</code> will <em>never match anything.</em></p>
  
  <p>Any suggestions?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I got a working solution (workaround). So my question is all about speed and a nice implementation.</p>