I have a working example here: http://jsfiddle.net/R7KuK/
I\'ve tried to create an array containing full regular expressions with regex delimiters and set flags, but the
as stolen from here:
Use the RegExp object constructor to create a regular expression from a string:
var re = new RegExp("a|b", "i"); // same as var re = /a|b/i;
Try this:
var regexSplit = regex.split( '/' );
var realRegex = new RegExp( regexSplit[1], regexSplit[2] );
Or better:
var regexMatch = regex.match( /^\/(.*)\/([^\/]*)$/ );
var realRegex = new RegExp( regexMatch[1], regexMatch[2] );
Better cause if your regex contains '/', the first one will fail. ;)