mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 11:42:36 +01:00
Allow flags on the regexen [#154]
This commit is contained in:
parent
24bb198c5d
commit
ed1b4bf717
@ -3,9 +3,10 @@ var _ = require('underscore')._;
|
|||||||
var regex = function(dbot) {
|
var regex = function(dbot) {
|
||||||
this.last = {};
|
this.last = {};
|
||||||
this.listener = function(event) {
|
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) {
|
if(q) {
|
||||||
var toMatch = new RegExp(q[2]),
|
var flags = q[4],
|
||||||
|
toMatch = new RegExp(q[2], flags),
|
||||||
replaceWith = q[3],
|
replaceWith = q[3],
|
||||||
last,
|
last,
|
||||||
replacement;
|
replacement;
|
||||||
|
Loading…
Reference in New Issue
Block a user