User Control Panel
Advertisements

HELP US, HELP YOU!

keyword..

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
m6246
Newbie
Newbie


Joined: 08 Jul 2005
Posts: 15

Reputation: 10.4

PostPosted: Fri Jul 08, 2005 10:04 am    Post subject: keyword.. Reply with quote

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'

thanks!
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Fri Jul 08, 2005 11:51 am    Post subject: Reply with quote

It will work.
_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Fri Jul 08, 2005 4:42 pm    Post subject: Re: keyword.. Reply with quote

m6246 wrote:
if ( $message =~ /^status$/i) {
...
}


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/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group