[Yaml] Fixed the escaping of strings starting with a dash when dumping

Dashes need to be escaped in character sets in regexes as they are used to
specify a range otherwise.
Refs #9039