Extracts ranges from the range string.
function getRange(text) {
  const range = text.match(/\d+/g).map(Number);

  if (Number.isFinite(range[1]) && range[1] < range[0]) {
    throw new SyntaxError(`Numbers out of order in ${text} quantifier`);
  }

  return range;
}