Fix bad code, used the wrong regexp index
Added more testcases