Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page is for anyone writing expressions, macros or scripts in which you need to escape special characters.

When writing expressions, macros or scripts you may need to enter a character that has special meaning. For example, a string could include a double-quote, but in the expression PhixFlow will read this as the end of the string. To tell PhixFlow to ignore a special character, you can use the backslash character.  

CharacterEscape string

backspace

 "\b"
"\\\\b"
form feed "\f"
"\\\\f"
tab"\t"
"\\\\t"
carraige return"\r"
"\\\\r"
newline"\n"
"\\\\n"
backslash

"\\\\"

"\\\\\\\\"
double quote'"'
'\\\\"'

Macro: Escaping Invalid Characters

If you are working with JSON, return messages can contain characters that are not recognised in PhixFlow. The following macro escapes these invalid characters.

do(
    $value = $args[1],
    $value = replaceAll( $value , "\b","\\\\b"),
    $value = replaceAll( $value , "\f","\\\\f"),
    $value = replaceAll( $value , "\t","\\\\t"),
    $value = replaceAll( $value , "\r","\\\\r"),
    $value = replaceAll( $value , "\n","\\\\n"),
    $value = replaceAll( $value , "\\\\","\\\\\\\\"),
    $value = replaceAll( $value , '"','\\\\"')
)


  • No labels