LMS.ExtractBetween - Extract Text Between Delimiters

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > LMS. - LM-Studio Commands > NEW: LMS v2.1 Commands - Model Query, Status, and Text Extraction >

LMS.ExtractBetween - Extract Text Between Delimiters

Extracts text between two delimiter strings. Useful for parsing structured content where specific markers define the start and end of desired content.

Syntax:

LMS.ExtractBetween|$$SOURCE|$$START|$$END|$$OCCUR|$$RET_VAR

Parameters:

$$SOURCE (String, required) - Source text to search.

$$START (String, required) - Starting delimiter.

$$END (String, required) - Ending delimiter.

$$OCCUR (Number, required) - Which occurrence (1=first, 2=second).

$$RET_VAR (Variable, required) - Variable to receive extracted text.

Examples:

; Extract text between brackets

text = "Start [content1] middle [content2] end"

LMS.ExtractBetween|text|[|]|1|first

; first now contains "content1"

 

LMS.ExtractBetween|text|[|]|2|second

; second now contains "content2"

See Also:

LMS.ExtractCodeBlockLMS.ExtractXmlTag