trim: add support for multiple ranges