If we re.split on the braces, we get:
In [7]: re.split(r'\{(.*?)\}',userstring)
Out[7]: ['--device=dev', '01,02', '', 'nyc', '.hukka.com']
Every other item in the list came from inside braces, which we next need to split on commas:
In [8]: [ part.split(',') if i%2 else [part] for i,part in enumerate(re.split(r'\{(.*?)\}',userstring)) ]
Out[8]: [['--device=dev'], ['01', '02'], [''], ['nyc'], ['.hukka.com']]
Now we can use itertools.product to enumerate the possibilities:
import re
import itertools
userstring = '--device=dev{01,02}{nyc}.hukka.com'
for x in itertools.product(*[ part.split(',') if i%2 else [part] for i,part in
enumerate(re.split(r'\{(.*?)\}',userstring)) ]):
print(''.join(x))
yields
--device=dev01nyc.hukka.com
--device=dev02nyc.hukka.com