...
...
This page describes the syntax for string literal expressions in PhixFlow.
All expressions in PhixFlow are written in the PhixFlow scripting language, and every expression resolves to one of the following:
- A regular expresion, following the POSIX style
- A string literal expression
In most input fields you will need to use a string literal expression, and regular expressions are commonly passed to one of the text functions, e.g. replaceAll().
Regular expressions are used for text pattern-matching, whereas string literals can be used both to do literal character matching and provide output values. In simple terms, writing a string literal expression for a string valued field on a stream would result in a (that) string being output to the database, but a regular expression would have no meaning in this context.
Examples:
If you want the string abc"def.
Use single quotes if you want to embed a double quote (or visa versa), or prefix the quote with a backslash:
e.g. 'abc"def' or "abc\"def".
...
Required output | Example Text Expression | ||
---|---|---|---|
Completed | "Completed" | ||
abc"def | To embed a quote mark:
| ||
The account number ACC46242 failed | Generate a message including the current account number being processed, which is provided by _out.accountNumber:
| ||
This message is finished. |
|
Escaping Special Characters
When writing expressions 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.
You must use a backslast to escape any of the special characters listed in the table below.
Character | Type | Escape string |
---|---|---|
backspace | Represented As | "\b" |
Escaped | "\\\\b" | |
form feed | Represented As | "\f" |
Escaped | "\\\\f" | |
tab | Represented As | "\t" |
Escaped | "\\\\t" | |
carraige return | Represented As | "\r" |
Escaped | "\\\\r" | |
newline | Represented As | "\n" |
Escaped | "\\\\n" | |
backslash | Represented As |
|
Escaped | "\\\\\\\\" | |
double quote | Represented As | '"' |
Escaped | '\\\\"' |
Example
The following macro escapes special characters.
Code Block | ||
---|---|---|
| ||
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 , '"','\\\\"')
)
|