How to use regex in hubot.respond?
opened this issue · comments
I want to pattern six figures when robot hear something like :675849 .
and I try to use regex like this:
robot.respond(/^\d{6}$/,function(res) { return res.send("success") })
it's not working . Instead of that, I'm using
robot.respond(/code is (.*)/i, function(res) { //add regex here })
it works fine. But I still want to know how can I use regex directly?
I see your docs , and there are some regex but always with some word, so don't know how to achieve that.
thanks for your time, many thx !
robot.respond(/(\d{1,6})(.*)/i,function(msg){return res.send("success") })
try correcting your braces.