How to check whether a string contains special character in ruby. If I get regular expression also it is fine.
Please let me know
Use str.include?.
str.include?
Returns true if str contains the given string or character.
true
str
"hello".include? "lo" #=> true "hello".include? "ol" #=> false "hello".include? ?h #=> true