pattern matcher working