jyotishb
asked on
Regular expression
Hi,
How do i find out if a string contains any non alpha numeric characters using regular expression, in python?
Thanks
How do i find out if a string contains any non alpha numeric characters using regular expression, in python?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
def has_non_alpha_num(s):
return bool(re.search(r'[^a-zA-Z0
print has_non_alpha_num("123") # Prints False
print has_non_alpha_num("abc") # Prints False
print has_non_alpha_num("Hello!"