TYPOC-28: add tests for match() and fix match()