implement matcher, replacer and query functionality