checkRegex = (regexString, errorDescription) => {
    let match;

    const regexp = RegExp(regexString, 'gm');

    while ((match = regexp.exec(format)) !== null) {
      /**@type {string} */
      const indexString = format.substr(0, match.index);

      const lines = indexString.split('\n');

      //starts at 1 to fit with most editors
      const lineCount = lines.length;
      const index = lines[lines.length - 1].length;

      const encasedFormat =
        format.substring(0, match.index - 1) +
        '[' +
        format.substring(match.index, match.index + match[0].length) +
        ']' +
        format.substring(match.index + match[0].length);

      const globalLines = encasedFormat.split('\n');

      const example =
        '\n----------------------------------------\n' +
        globalLines.slice(lineCount - 2, lineCount + 1).join('\n') +
        '\n----------------------------------------';
      errors.push({
        error: errorDescription,
        line: lineCount,
        index,
        example,
      });
    }
  }
@type {Array<{
 error:string,
 line:number,
 index:number,
 example:string
}>}