pattern =
      pattern.slice(0, token.index) +
      token[1].repeat(repetitions) +
      pattern.slice(token.index + token[0].length);