src/helpers.js
function cloneRegexp(re) {
  const pattern = re.source;

  let flags = '';

  if (re.global) flags += 'g';
  if (re.multiline) flags += 'm';
  if (re.ignoreCase) flags += 'i';
  if (re.sticky) flags += 'y';
  if (re.unicode) flags += 'u';

  return new RegExp(pattern, flags);
}
function cloneRegexp(re) {
  const pattern = re.source;

  let flags = '';

  if (re.global) flags += 'g';
  if (re.multiline) flags += 'm';
  if (re.ignoreCase) flags += 'i';
  if (re.sticky) flags += 'y';
  if (re.unicode) flags += 'u';

  return new RegExp(pattern, flags);
}
function cloneRegexp ( re ) { const pattern = re . source ; let flags = '' ; if ( re . global ) flags += 'g' ; if ( re . multiline ) flags += 'm' ; if ( re . ignoreCase ) flags += 'i' ; if ( re . sticky ) flags += 'y' ; if ( re . unicode ) flags += 'u' ; return new RegExp ( pattern , flags ) ; }
Function cloning the given regular expression. Supports `y` and `u` flags
already.

@param  {RegExp} re - The target regular expression.
@return {RegExp}    - The cloned regular expression.
Function cloning the given regular expression . Supports y and u flags already .