From: Chuft Captain Date: 2009-04-09T13:05:00+09:00 Subject: A hopefully simple question Hello, I downloaded an irc bot written in Ruby. I haven't programmed in many years but couldn't resist the urge to tinker with the code so I peeked inside. Basically I am trying to add additional string recognition statements to this bot, so it says things in response to things people say in the channel. For example the code contains this statement: elsif msg.text == "lol" reply(msg, " LOLOLOLOL") This works fine. However I would like to have it respond if the statement being evaluated has "lol" anywhere in it, not just if it is exactly "lol". In other words, I want to search their string, which appears to be in the variable msg.text, to see if it contains "lol". In the past, I have found this to be a simple matter in other languages. I have been unable to find out how to do this in Ruby. If I try this: elsif msg.text.include? "lol" reply(msg, " LOLOLOLOL") the bot either does not run at all, or else quits immediately. Similar instant failure occurs when I try elsif msg.text.include?("lol") reply(msg, " LOLOLOLOL") or elsif msg.text =~ "lol" reply(msg, " LOLOLOLOL") Is there a simple way to accomplish this task by replacing the == comparison operator with something else that searches a string variable for a substring? Thanks -- Posted via http://www.ruby-forum.com/.