add pattern matcher utility class and test