diff --git a/modules/regex/regex.js b/modules/regex/regex.js index 42182aa..48b8e21 100644 --- a/modules/regex/regex.js +++ b/modules/regex/regex.js @@ -3,13 +3,15 @@ var _ = require('underscore')._; var regex = function(dbot) { this.last = {}; this.listener = function(event) { - var q = event.message.valMatch(/^([\d\w\s]*)?:? ?s\/(.+)\/(.+)\/([ig]*)?$/, 5); + var q = event.message.valMatch(/^([\d\w\s]*)?:? ?s\/(.+)\/(.+)?\/([ig]*)?$/, 5); if(q) { var flags = q[4], toMatch = new RegExp(q[2], flags), replaceWith = q[3], last, replacement; + + if(!replaceWith) replaceWith = ""; if(q[1] != null) { var user = q[1];