This method and its 2 private helpers are quite the same in the Regex and the Turnip generators. Is it possible to share the logic instead of copy-pasting it ?