String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !BLO.-Block-Commands > Block Extraction >

String Operations

BLO.BlockGetLast

Previous Top Next


MiniRobotLanguage (MRL)

 

BLO.BlockGetLast

Gets the last complete top-level block.

 

 

clip1142

 

Intention

 

This command identifies the final complete block in a string, using start/end delimiters while respecting nested structures. It locates the last unmatched opening delimiter and its corresponding closing delimiter.

Essential for processing log files, configuration sections, or multi-block documents where final elements matter most.

 

 

Syntax

 

BLO.BlockGetLast|P1|P2|P3|P4

 

Parameter Explanation

 

P1 - (Input, Text) Source string containing blocks

P2 - (Input, Text) Opening delimiter marker

P3 - (Input, Text) Closing delimiter marker

P4 - (Output, Text) Variable storing last complete block

 

 

                   Identifying Final Top-Level Block

 

                       ┌────────────────────────┐

                       │                        │

                       ▼                        ▼

Source String:     [ITEM] First Block [/ITEM][ITEM] Last Block With[Nested][/Nested][/ITEM]

    Start Delimiter:   └────────────────────────┘                                       │ 

End Delimiter matched, ignoring earlier blocks: └───────────────────────────────────────┘

 

Result: "[ITEM] Last Block With[Nested][/Nested][/ITEM]"

 

 

 

Example

 

'***********************************

' BLO.BlockGetLast Example

'***********************************

$$SRC=[START]First Block[/START][START]Final Block[Nested][/Nested][/START]

BLO.BlockGetLast|$$SRC|[START]|[/START]|$$RES

PRT. $$RES

PRT.contains the final complete block:

PRT."[START]Final Block[Nested][/Nested][/START]"

MBX.$$RES

ENR.

 

Remarks

 

Returns empty string if no valid block exists

 

See also:

 

BLO.BlockGetLastEx - Extended block information

BLO.BlockGetNth - Gets specific block by index