start and end of input matching and some tests