I only want to allow alphanumeric & a few characters (+, -, _, whitespace) in my string. But python seems to allow @ and . (dot) along with these. How do I exclude @?
import re
def isInvalid(name):
    is_valid_char = bool(re.match('[a-zA-Z0-9+-_\s]+$', name))
    if not is_valid_char:
        print('Name has invalid characters')
    else:
        print('Name is valid')
        
isInvalid('abc @')    
This outputs 'Name is valid', how do I exclude @? Have tried to search this, but couldn't find any use case related to @. You can try this snippet here - https://www.programiz.com/python-programming/online-compiler/
 
     
    