=~ is a matching operator : matching operator « String « Ruby






=~ is a matching operator


puts "String contains no digits" unless "This is a test" =~ /[0C9]/

 

Related examples in the same category

1.if a string contains any vowels: