function augment(regex, captureNames, isNative) {
        var p;
        // Can't auto-inherit these since the XRegExp constructor returns a nonprimitive value
        for (p in self.prototype) {
            if (self.prototype.hasOwnProperty(p)) {
                regex[p] = self.prototype[p];
            }
        }
        regex.xregexp = {captureNames: captureNames, isNative: !!isNative};
        return regex;
    }
Attaches XRegExp.prototype properties and named capture supporting data to a regex object.
@private
@param {RegExp} regex Regex to augment.
@param {Array} captureNames Array with capture names, or null.
@param {Boolean} [isNative] Whether the regex was created by `RegExp` rather than `XRegExp`.
@returns {RegExp} Augmented regex.