Improve TTextTools::match() function