I saw this on a screencast and couldn’t figure out what it was. Reference sheets just pile it in with other operators as a general pattern match operator.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It matches string to a regular expression.
'hello' =~ /^h/ # => 0If there is no match, it will return
nil. If you pass it invalid arguments (ie, left or right-hand sides are not correct), it will either throw aTypeErroror returnfalse.