regex from head on and from behind