function cloneRegex(pattern) {
    return eval("" + pattern + (!pattern.global ? "g" : ""));
  }
"Clones" a regular expression (but makes it always global).

@private
@param {RegExp|string} pattern
@returns {RegExp}