I think it's a useful future direction! However, I wanted to clarify two things:
Regex's underlying representation is not the textual regex, but a general-purpose pattern matching program (for efficiency). So obtaining a textual regex fromRegexwould be a conversion.- Not every
Regexbuilt with regex builder can be converted to a textual regex. Regex builder supports arbitrary types that conform to theRegexComponentprotocol, includingCustomMatchingRegexComponent(pitched in regex-powered string processing algorithms) which can be implemented with arbitrary code. If aRegexcontains aCustomMatchingRegexComponent, it cannot be converted to a textual regex.