From ed1b4bf7173218218f7ebeb28e8125c679604668 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 21 Jan 2013 20:32:34 +0000 Subject: [PATCH] Allow flags on the regexen [#154] --- modules/regex/regex.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/regex/regex.js b/modules/regex/regex.js index 50dd5b6..42182aa 100644 --- a/modules/regex/regex.js +++ b/modules/regex/regex.js @@ -3,9 +3,10 @@ var _ = require('underscore')._; var regex = function(dbot) { this.last = {}; this.listener = function(event) { - var q = event.message.valMatch(/^([\d\w\s]*)?:? ?s\/(.+)\/(.+)\/$/, 4); + var q = event.message.valMatch(/^([\d\w\s]*)?:? ?s\/(.+)\/(.+)\/([ig]*)?$/, 5); if(q) { - var toMatch = new RegExp(q[2]), + var flags = q[4], + toMatch = new RegExp(q[2], flags), replaceWith = q[3], last, replacement;