regex better

This commit is contained in:
Luke Slater 2011-08-25 14:17:15 +01:00
parent 768b88d005
commit 886a4d3baa

View File

@ -4,7 +4,7 @@ var youAre = function(dbot) {
return { return {
'listener': function(data) { 'listener': function(data) {
var num = Math.floor(Math.random()*11); 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']*),?\.?/);
if(key[1].indexOf('and') !== -1) { if(key[1].indexOf('and') !== -1) {
key[1] = key[1].split('and')[0]; key[1] = key[1].split('and')[0];
} // TODO: fix the regex to do this. i hate regex } // TODO: fix the regex to do this. i hate regex