I'm writing a simple validation for a filename with a rule that It should not contains any spaces and special symbols except underscore.
for space I will use the re.search :
word = 'some thing'
space_checker = bool(re.search(r"\s", word))
And for finding the speical characters except underscore all I know is the regex pattern :
words_with_underscore = ^a-zA-Z0-9_
How to combine both of it to make the restriction ?