code: function regexpToGlobalRegexp(regexp) {
    let source = regexp instanceof RegExp ? regexp.source : regexp
  
    return new RegExp(source, 'g')
  }
docs: Newer javascript engines allow setting flags when passing existing regexp
  to the RegExp constructor, until then, we extract the regexp source and
  build a new object.
  
  @param {RegExp|string} regexp The regexp to modify
  @return {RegExp} The new regexp instance