title: Regular expression with a given length with an exact number of a character
body: <p>I'm looking for a regular expression for the language <img src="https://i.stack.imgur.com/f0HhV.png" alt="$w\in {a,b}^n$"> with the exact number of <strong><em>k a</em></strong>'s in it.</p>
  
  <p>I'm pretty much stuck at this. For a various length the solution would be easy with <img src="https://i.stack.imgur.com/LIiTa.png" alt="${{b}^*a{b}^*}^k$">.</p>
  
  <p>Does anybody have any advice on how I can achieve such an regex?</p>