Rewrite rucheUtil().match, add tests and documentation