Posted: Fri Jul 08, 2005 10:04 am Post subject: keyword..
i have this code
if ( $message =~ /^status$/i) {
...
}
so the bot replies something when the user says status. However perl interprets status as if it is some keyword (its turning red in my editor and it dont work in msn).
So how do i solve this? I need the bot to reply to 'status'
In a regexp, a ^ at the beginning means "starts with" and a $ at the end means "ends" with. When you use both, it means that the string must contain ONLY the word "status"
i.e.
"tell me the current status" --won't work
"whats your status now?" --won't work
"status" --works
without the quotes of course
If you want it to just check for "contains anywhere" then remove the ^ and $, and then all three of those examples would work. _________________ Current Site (2008) http://www.cuvou.com/