prepareRegExp(tag) {
    let length;
    let regExp;
    if (tag instanceof RegExp) {
      regExp = tag;
      length = 1; // ASSUMPTION: regexp only tests one character
    } else {
      // use prepared regexp if present
      const prepared = tagPattern[tag];
      if (prepared !== undefined) {
        regExp = prepared;
      } else {
        regExp = new RegExp(tag);
      }

      length = tag.length;
    }

    return [regExp, length];
  }
Create a regular expression for the tag if it isn't already one.

The return value is an array `[RegExp, number]`, with exactly two value, where:
- RegExp is the regular expression to use
- number is the lenth of the input string to match
@param {string|RegExp} tag  string to match in text
@returns {Array}  regular expression to use and length of input string to match
@private