title: Using variables in Python regular expression
body: <p>I'm parsing a file and looking in the lines for <code>username-#</code> where the username will change and there can be any number of digits <code>[0-9]</code> after the dash.</p>
  
  <p>I have tried nearly every combination trying to use the variable <code>username</code> in the regular expression. </p>
  
  <p>Am I even close with something like <code>re.compile('%s-\d*'%user)</code>?</p>