Application icon

Extract Bracketed Text

This function is used to look for text, within a field or named variable, bracketed by one of (), [ ], < >, or { }.

If the From the end option is selected the last occurrence will be extracted. If the option is not selected, the first occurrence will be selected.

The text within the chosen delimiters will be copied to the specified destination. If a match did not occur the destination will be cleared.

By default, balanced delimiter sequences are not required. For example looking for ( ) in:

abc (((def)

will return

((def

The Balanced setting forces matched sequences to be balanced. ie. the previous sequence will fail. Note that when extracting balanced sequences, only the outermost bracket sequence is removed. For example looking for ( ) in:

abc (012((def))345)

will return

012((def))345

If the Remove option is selected the text and its enclosing delimiters will be removed from the source. You can optionally elect to insert text to mark the location of the removed text.

All text strings may contain any of the escape sequences described in Escape Sequences.

When run Grouped, the action test state is set to true if an extraction occurred, otherwise it will be set to false. When run Stepwise, the action test state is set to true if any extractions occurred, otherwise it will be set to false.

Note that when a named variable is used, both the source and destination must be named variables. When executing stepwise and named variables are used, the statement is only executed once.