getPrettyFilter = expr => {

  // remove outer spaces and separate operands
  expr = expr.trim().replace('][', '] [');

  // regex to identify operands
  const re = /[+-]?\[.+?[\]\}\>]\]/g;

  // get operands
  const operands = expr.match(re);

  // replace operands with dummies and trim again to avoid trailing spaces
  expr = expr.replace(re, ' [] ').trim();

  // turn it into an array
  const stringsPlusDummies = expr.split(/\s+/);

  let operandIndex = 0;
  const parts = [];
  for (let i = 0, l = stringsPlusDummies.length; i < l; i++) {
    parts[i] = (stringsPlusDummies[i] === '[]' ? operands[operandIndex++] : stringsPlusDummies[i]);
  }

  return parts.join('\n');

}
Turns the filter expression in a nicely formatted (but unusable)
text, making it easier to edit long filter expressions.

@param {string} expr - A valid filter expression.
@result {string} A formatted (unusable) filter expression.