substitute indices for terminals without regex; fixes #32