handle ^ and $ in BRE subexpression start and end as anchors