import re
regex = re.compile(r'(?:\((\d{3})\)\s*|(\d{3})-?)')
print(filter(None, regex.match('(123) ').groups()))