When referring to quoting values such as strings, double quotes should be assumed. In edge cases where a string needs to enclose a double quote - for instance a complex command line string - paired single quotes may also be used.
Within quoted text a backslash (
\) escapes a character and a double backslash sequence (
\\) allows a literal backslash (
\) to be used. Besides escaping non-pairing quotes, standard escape codes like
\n indicating a new line character or
\t for a tab may be used.
However, a backslash cannot be used to escape literal single or double quote characters. This effectively limits the nesting of different types of quotes to one set inside another.
In action codes (or other operators) that are described as using regular expression patterns for their input arguments (i.e. 'patterns'), it may be possible to use the '\xdd' method to define characters in an escaped form such as tricks the first-pass parsing of single/double-quotes in arguments. Thus:
$Text = $Text.replace("XXX","\x22")
…replaces every instance of 'XXX' with a straight double quote character. Reference links:
- BOOST Regular Expression syntax (Perl flavour).
- Wikipedia ASCII codes - IMPORTANT: use the values in the 'Hex' column. Thus a straight double quote is
22, a straight single quote is
Whilst the mechanism should work for other characters, it is generally only single & double quotes which cause difficulties when used unmatched (or nested) within string literals (including patterns) in Tinderbox. The latter arises as quotes are used as delimiters for inputs and current parsing does not support a quote escape mechanism at initial-parse level. The above method 'hides' the quotes from that initial parse.