B2B TIP: Use regular expressions for labels

Using regular expressions can greatly simplify your BRANCH constructs. The regular expression appendix in the B2B Integrator Guide describes the syntax. The regular expression in a label must be surrounded with slashes. A couple of examples:

/.+/
Tests for one or more characters. Strings that are $null or are empty will not be selected by this label (e.g. the branch won’t take this path)

/^ISA/
Tests that the string starts with the characters “ISA”.

FLOW example:

BRANCH on ‘/tailOfAK5’
/.+/: MAP (tailOfAK5 has one or more chars)
$default: SEQUENCE (tailOfAK5 is empty or null)

There also a way to make the regular expression complex expressions.

In the Flow Branch properties set Evaluate Labels to true. Then each of the labels of the steps inside the Branch will be evaluated through an expression evaluator that supports &&; || and other boolean operators (the same type of expressions that can be added to a Flow Map Copy).

For instance, in my negative test cases after a call to WmPublic pub.flow:getLastError, I have the following expression as the label for my Success case:

%lastError/error%=%expectedErrorMessage%

The fail case has the label $default.