title: c# regular expressions, allow numbers and letters only not working
body: <p>I'm using ASP.NET MVC.</p>
  
  <p>I need a regular expression that allows only numbers and letters, not spaces or ",.;:~^" anything like that.  Plain numbers and letters.</p>
  
  <p>Another thing: 2 characters can't repeat consecutively.</p>
  
  <p>So I can have 123123 but not 1123456.</p>
  
  <p>I got as far as to:</p>
  
  <pre><code>Regex ER1 = new Regex(@"(.)\\1", RegexOptions.None);
  
  Regex ER2 = new Regex(@"[A-Z0-9]", RegexOptions.IgnoreCase);
  </code></pre>
  
  <p>I could not make it all in one expression and I still have some characters passing through.</p>
  
  <p>Here is my entire code for testing:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          string input = Console.ReadLine();
  
          Regex ER1 = new Regex(@"(.)\\1", RegexOptions.None);
  
          Regex ER2 = new Regex(@"[A-Z0-9]", RegexOptions.IgnoreCase);
  
          if (!ER1.IsMatch(input) &amp;&amp; ER2.IsMatch(input))
              Console.WriteLine( "Casou");
          else
              Console.WriteLine( "Não casou");
  
              Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>I find these expressions quite complex and I'd be really happy to have some help with this.</p>