You can try the following:
import re
a = ["terdsa223124", "ter223124dsa", "223124terdsa", "223124terdsa223124"]
final_output = {s:any([re.findall('^[\d\W]+[a-zA-Z]+$', s), re.findall('^[a-zA-Z]+[\d\W]+[a-zA-Z]+$', s), re.findall('^[a-zA-Z]+[\d\W]+$', s)]) for s in a}
Conclusion:
{'223124terdsa223124': False, '223124terdsa': True, 'terdsa223124': True, 'ter223124dsa': True}
source
share