0

What might be a good regex to detect strings which involves only (at least one) letter and special character? I checked this, How to check if a string contains only [numbers OR special characters] in python, but it didn't help.

I want to detect strings which involves only (at least one) letter and special character in python.

Community
  • 1
  • 1
yusuf
  • 3,591
  • 8
  • 45
  • 86

1 Answers1

1

maybe something like:

if re.search('\w+[!@#$%*()]+', string) or re.search('[!@#$%*()]+\w+', string):
    do_something()
Daniel
  • 473
  • 4
  • 9