title: Regex to find repetive number of length n
body: <p>I am trying to use golang regexp to find the repetition of digits. Here is what I have tried to find repetitive digits of length 8. I was trying to follow the suggestion at <a href="https://stackoverflow.com/questions/6507982/regex-to-find-repeating-numbers">Regex to find repeating numbers</a></p>
  
  <pre><code>    testString := "11111111" 
      repetitive := `^(\d)\\1{8}$`
      repetitiveR := regexp.MustCompile(repetitive)
      if repetitiveR.MatchString(testString) {
          fmt.Println("Match")
      } else {
          fmt.Println("No match")
      }
  </code></pre>
  
  <p>It always gives me result as "No match". Another way that works it is cumbersome</p>
  
  <pre><code>  testString := "11111111" 
    repetitive := `^(0{8})|(1{8})|(2{8})|(3{8})|(4{8})|(5{8})|(6{8})|(7{8})|(8{8})|(9{8})$`
    repetitiveR := regexp.MustCompile(repetitive)
    if repetitiveR.MatchString(testString) {
      fmt.Println("Match")
    } else {
      fmt.Println("No match")
    }
  </code></pre>
  
  <p>Output: Match</p>
  
  <p>Any suggestions</p>