From e62bacfa98b6df3a1703be2a9fa90008d31abf55 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Thu, 25 Aug 2011 14:19:17 +0100 Subject: [PATCH] regex better --- modules/youare.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/youare.js b/modules/youare.js index d46c500..2190433 100644 --- a/modules/youare.js +++ b/modules/youare.js @@ -4,13 +4,9 @@ var youAre = function(dbot) { return { 'listener': function(data) { var num = Math.floor(Math.random()*11); - var key = data.message.match(/ is|are ([\d\w\s']*),?\.?/); + var key = data.message.match(/ is|are ([\d\w\s']*),?\.?and?/); if(num == 1 && key != undefined) { - if(key[1].indexOf('and') !== -1) { - key[1] = key[1].split('and')[0]; - } // TODO: fix the regex to do this. i hate regex - dbot.say(data.channel, data.user + ': You\'re ' + key[1]); } },