function getPrefix(name, separator) {
  const rootSeparator = String.raw`(?<!\[[a-z0-9\-]*)(${separator})(?![a-z0-9\-]*\])`;
  const rootSeparatorRegex = new RegExp(rootSeparator);
  let classname = name;
  let index = 0;
  let results;
  while ((results = rootSeparatorRegex.exec(classname)) !== null) {
    const newIndex = results.index + separator.length;
    index += newIndex;
    classname = classname.substring(newIndex);
  }

  return index ? name.substring(0, index) : '';
}
Returns the prefix (variants) of a className including the separator or an empty string if none

@param {String} name Classname to be parsed
@param {String} separator The separator character as in config
@returns {String} The prefix