Use regexes in factory for better future-proofing