reimplement the regex matching strategy by building a single