title: regex to check all digits in are same or not
body: <p>I have input field which takes 12 digits number. I want to throw error when user enters 12 digits same number. Atleast one number has to be different.</p>
  
  <p>E.g </p>
  
  <pre><code>   111111111111 - Error
  
     111111111112 - Ok
  
     123456789012 - Ok
  </code></pre>
  
  <p>I tried this (but i want inverse of the specified regex )</p>
  
  <pre><code>var pattern = "^([0-9])\\1{3}$";
  var str = "5555";
  pattern = new RegExp(pattern);
  if(!pattern.test(str))
  {
      alert('Error');
  }
  else
  {
      alert('Valid');
  }
  </code></pre>
  
  <p>code from : <a href="https://stackoverflow.com/a/2884414/1169180">https://stackoverflow.com/a/2884414/1169180</a></p>
  
  <p>Fiddle : <a href="http://jsfiddle.net/wn9scv3m/10/" rel="nofollow noreferrer">http://jsfiddle.net/wn9scv3m/10/</a></p>
  
  <p><strong>Edit:</strong> No manipulation in     <code>if(!pattern.test(str))</code> in this line is allowed </p>