Improved YAML parsing

This seems to work. 8e795b5 will be removed and a246d26 will be modified to use the forthcoming YAML modifications. c3c8791 will also need a closer look. I'm not convinced that regex is exhaustive.
Still doesn't include ^ and $