Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page is for anyone writing text strings in expressions, macros or scripts. It also includes informtion about how to escape special characters.

Using Text Expressions

In PhixFlow, a text expression is made up from a string of characters inside double quotes

...

.  Text expressions can also include variable elements so that data from streams or other PhixFlow items can be inserted into the string. The expression must evaluate to a fixed string

...

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

Regular expressions are used for text pattern-matching, whereas plain text expressions can be used both to do literal character matching and provide output values. In simple terms, writing a plain text 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".

Note how this contrasts to the regular expression case, where a double-backslash is used to escape special characters.

See Also

...

.


Panel
borderColor#7da054
titleColorwhite
titleBGColor#7da054
borderStylesolid
titleSections on this page

Table of Contents
maxLevel3
indent12px
stylenone



Required output
Example Text Expression
Completed"Completed"
abc"def

To embed a quote mark:

  • Either use  a combination of single and double quotes   'abc"def'
  • Or prefix the quote with a backslash  "abc\"def"


Note

This is different to regular expressions, in which a double-backslash is used to escape characters.


The account number ACC46242 failed

Generate a message including the current account number being processed, which is provided by _out.accountNumber:

"The account number " + _out.accountNumber + " failed"

This message

is finished.

"This message\n" +

"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.

CharacterTypeEscape string

backspace

Represented As "\b"
Escaped "\\\\b"
form feedRepresented As "\f"
Escaped"\\\\f"
tabRepresented As"\t"
Escaped "\\\\t"
carraige returnRepresented As"\r"
Escaped "\\\\r"
newlineRepresented As"\n"
Escaped "\\\\n"
backslashRepresented As

"\\\\"

Escaped "\\\\\\\\"
double quoteRepresented As'"'
Escaped '\\\\"'

Example

The following macro escapes special characters. 


Code Block
titleMacro
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 , '"','\\\\"')
)


See Also