regexFactory: matches function