<human>:  Using variables in Python regular expression
<bot>: Here is some code to regular expression for validating string 'user' containing a sequence of characters ending with '-' followed by any number of digits.

re.compile('{}-\\d*'.format(user))

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.