(#17094) Escape variable name in parse_string

Without this, parse_string would break (usually with an infinite loop) if a
variable name had characters that were significant in a regular expression.

The patch to the method itself is from Peter De Cleyn.