in reply to Re: Regexp problem matching commands for IRC bot
in thread Regexp problem matching commands for IRC bot

That shouldn't be the problem. Yes, it'll try that first, but in order to match the PRIVMSG part, it'll have to back off. My guess would be that it's something like CRLF issues. The best bet to debug it would be to look at exactly what's held in $message, checking for any characters you weren't expecting (trailing spaces? Trailing carriage return? etc), and possibly match against just /^!quit/ or /^!quit\b/, or maybe /^!quit\s*$/. But the advice to use an existing IRC framework like Net::IRC is good.

Replies are listed 'Best First'.
Re^3: Regexp problem matching commands for IRC bot
by StrifeChild (Novice) on Dec 17, 2004 at 20:25 UTC
    Yeah, I also forgot to explain that if you just use the ^ in the regex it does not work, not does just using $, so there might be something in front and back of !quit in $message.
      Have you tried simply printing out the contents of $message?
      print "\$message is '$message'\n";
      That should at least help you figure out why it's not matching.
      Ah, it looks like: <code> $message is ':Admin!Admin@leet-A0B340B0.host.com PRIVMSG #channel :!quit ' <code> Not good.
        We can't help you if you don't show the code you actually used. The only time you'd get that string in message in the code you showed us was is the $_ was something like
        :something!something PRIVMSG #channel :Admin!Admin@leet-A0B340B0.host.com PRIVMSG #channel :!quit
        (assuming $channel was regexp matching '#channel').