Add feature to extract keys from a pattern without needing to parse a string (with tests).