title: Regular Expression question for occurence check :
body: <p>Check if a number n occurs n times and that too consecutively in a string.</p>
  
  <p>For example : 
  String x = "33322"
  Case 1 : If int N = 3;</p>
  
  <p>Check if 3 occurs 3 times consecutively in "33322". </p>
  
  <p>Here 3 occurs 3 times consecutively in "33322". Hence, we return true.</p>
  
  <p>Case 2 : If int N = 2;</p>
  
  <p>Check if 2 occurs 2 times consecutively in "33322". </p>
  
  <p>Here 2 occurs 2 times consecutively in "33322". Hence, we return true.</p>
  
  <p>I have tried various Regular Expression but may be because of not being very thorough, I am not clear what expression will help me in achieving this task. I have tried with the given Regular Expression pattern 
  : "^["+N+"]{"+(N-1)+"}("+N+")$".</p>
  
  <p>But for this the output is coming false, whereas it should have been true as you can see that the number 3 clearly is occurring 3 times in the above example.</p>
  
  <p>Here I am looking for a Regular Expression that can match with all possible values for N.</p>
  
  <p>N can be from 2-500</p>