function _addRegExpFlags(re, flags) {
  let foundMissing = false
  let reFlags = re.flags
  for (let i = 0; i < flags.length; ++i) {
    if (reFlags.indexOf(flags[i]) === -1) {
      foundMissing = true
      reFlags += flags[i]
    }
  }
  return foundMissing ? new RegExp(re.source, reFlags) : re
}
Merges the given flags with those already in a regular expression.

@param {RegExp} re     - The regular expression to add flags to.
@param {string} flags  - The flags to add to the regex.
@returns {RegExp} - A regular expression with all the given flags added.