import re
r = re.compile(r'[<>%;$]') # Regex matching the specific characters
chars = set('<>%;$')       # Define the set of chars to check for

def checkString(s):
	if any((c in chars) for c in s): # If we found the characters in the string
		return False                 # It is invalid, return FALSE
	else:                            # Else
		return True                  # It is valid, return TRUE
		
def checkString2(s):
	if r.search(s):   # If we found the "bad" symbols
		return False  # Return FALSE
	else:             # Else
		return True   #  Return TRUE

s = 'My bad <string>'
print(checkString(s))
print(checkString2(s))
s = 'My good string'
print(checkString(s))
print(checkString2(s))