fix bug in StringMatch; pull out tests into test suite