Handle arbitrary prefix/suffixes