Using Regex to recognize pattern in string <p><em>I apologize if this is a repeat question, as I know there are many about Regex on StackOverflow, but I have yet to find an answer or a level of help I need.</em></p> <blockquote> <p>I have a string that needs to be a length of 8 where:</p> <ul> <li><p>The first two characters are letters</p></li> <li><p>The next five characters are numbers</p></li> <li><p>The last character is a letter</p></li> </ul> <p>For example: "AB12345C"</p> </blockquote> <p>I have been using the examples from <a href="https://msdn.microsoft.com/en-us/library/sdx2bds0(v=vs.110).aspx" rel="nofollow">MSDN</a> &amp; <a href="http://www.dotnetperls.com/regex" rel="nofollow">DotNetPerls</a> to try and understand how to use arguments properly, but after a couple days of reading around I still can't get it to pass.</p> <p>I am currently trying to use:</p> <pre><code>public Tuple&lt;bool, string&gt; stringFormatCheck(string input) { if (Regex.IsMatch(input, @"^[a-zA-Z]\d{2}[0-9]\d{5}[a-zA-Z]$") == true) return Tuple.Create(true, "String is Fine"); else return Tuple.Create(false, "String Format is incorrect"); } </code></pre> <p>Can someone show me how to use this argument properly or somewhere I can get a better understanding of the Regex Class? Thank you.</p> <p>EDIT1: The second Z in my first argument is now capitalized.</p>