From d6c54601d634a4ef6e4d0b234ed6a25f7dfc8fe0 Mon Sep 17 00:00:00 2001
From: Alexandre Morignot <erdnaxeli@gmail.com>
Date: Thu, 16 Oct 2014 17:44:33 +0200
Subject: [PATCH] better regex

---
 lib/commands/parser.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/commands/parser.pm b/lib/commands/parser.pm
index 91caf20..6b1ea97 100644
--- a/lib/commands/parser.pm
+++ b/lib/commands/parser.pm
@@ -43,7 +43,7 @@ sub exec {
 	my ($kernel, $user, $chan, $msg) = @_;
 	my ($nick, $mask) = split(/!/,$user);
 
-    if ($msg =~ /^ *!fav(?: (\S+))?/) {
+    if ($msg =~ /^ *!fav(?: (\S+))? *$/) {
         my $index = $1;
         try {
             my $id = utils::id::get($chan->[0], $index);
@@ -52,7 +52,7 @@ sub exec {
             $irc->yield(privmsg => $chan->[0] => $insultes[rand @insultes]);
         }
 	}
-	elsif ($msg =~ /^ *!later(?: (-?[0-9]+))?(?: in ([0-9]*)?(h|m|s)?)?/) {
+	elsif ($msg =~ /^ *!later(?: (\S+))?(?: in (\d)+(h|m|s)?)? *$/) {
         my $index = $1;
         my ($time, $unit) = ($2, $3);
 
@@ -63,7 +63,7 @@ sub exec {
             $irc->yield(privmsg => $chan->[0] => $insultes[rand @insultes]);
         };
 	}
-    elsif ($msg =~ /^( *!tag)(?:( +)(-?[0-9]+))?/) {
+    elsif ($msg =~ /^( *!tag)(?:( +)(-?\d+))?/) {
         my $index = $3;
         my $id;
 
-- 
GitLab