1 /** Used to match `RegExp` flags from their coerced string values. */
5 * Creates a clone of `regexp`.
8 * @param {Object} regexp The regexp to clone.
9 * @returns {Object} Returns the cloned regexp.
11 function cloneRegExp(regexp) {
12 var Ctor = regexp.constructor,
13 result = new Ctor(regexp.source, reFlags.exec(regexp));
15 result.lastIndex = regexp.lastIndex;
19 module.exports = cloneRegExp;