StrifeChild has asked for the wisdom of the Perl Monks concerning the following question:
$_ is comming from the socket. The user, host and message do get parsed out correctly, but when it comes to the commands, !quit for an example, it will only work if I broaden the regex by removeing the carrot and the scalar, ^ and $. The striing being parsed looks exactly like:if($_ =~ /^:(.*)!(.*) PRIVMSG $channel :(.*)$/){ my $user = $1; my $host = $2; my $message = $3; if($message =~ /^!quit$/){ die "Quiting!\n"; } }
Is $message being giving some unseen values from $3 that would not allow the !quit command from working when it is fine tuned with ^ and $? If it it is not fine tuned, !quit could appear anywhere in the message and work, which is not good :) Thanks for any ideas and help.:Admin!Admin@leet-A0B340B0.host.com PRIVMSG #channel :!quit
Retitled by davido.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regexp problem matching commands for IRC bot
by ikegami (Patriarch) on Dec 17, 2004 at 20:44 UTC | |
|
Re: Regexp problem matching commands for IRC bot
by friedo (Prior) on Dec 17, 2004 at 20:09 UTC | |
by Eimi Metamorphoumai (Deacon) on Dec 17, 2004 at 20:20 UTC | |
by StrifeChild (Novice) on Dec 17, 2004 at 20:25 UTC | |
by Eimi Metamorphoumai (Deacon) on Dec 17, 2004 at 20:34 UTC | |
by StrifeChild (Novice) on Dec 17, 2004 at 20:38 UTC | |
by ikegami (Patriarch) on Dec 17, 2004 at 23:39 UTC | |
by StrifeChild (Novice) on Dec 17, 2004 at 20:18 UTC | |
|
Re: Regexp problem matching commands for IRC bot
by Forsaken (Friar) on Dec 21, 2004 at 15:33 UTC |