code: function generateTagRegex(token, openTag, closeTag, singleTag) {
      let tokenString = token.source;
      const modifier = token.ignoreCase ? "gi" : "g";
  
      tokenString = tokenString.replace(/\\s/g, "\ ");
      if (singleTag) {
          tokenString = tokenString + "?";
      } else {
          tokenString = "\\ *?" + tokenString + "?\\ *?";
      }
      return new RegExp(openTag + tokenString + closeTag, modifier);
  }
docs: Helper (private) functions Returns final regex for a xejs tag