another attempt at the bracket validator, incorporating pipe characters