Make catcierge_parse_list optionally trim ending whitespace.
Fixed some bugs discovered by new test cases.

Also make the match template variables be index between 1-4 instead of 0-3.
Some small fixes and changes.