code: function clone (regex, additionalFlags) {
          if (!XRegExp.isRegExp(regex))
              throw TypeError("type RegExp expected");
          var x = regex._xregexp;
          regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || ""));
          if (x) {
              regex._xregexp = {
                  source: x.source,
                  captureNames: x.captureNames ? x.captureNames.slice(0) : null
              };
          }
          return regex;
      }
docs: Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp` instance with a fresh `lastIndex` (set to zero), preserving properties required for named capture. Also allows adding new flags in the process of copying the regex