I am trying to validate strings in ruby. Any string which contains spaces,under scores or any special char should fail validation. The valid string should contain only chars a-z
No regex:
def validate(str) str.count("^a-zA-Z0-9").zero? # ^ means "not" end