@BETWEEN — Returns the portion of a string between two delimiters.
Syntax:
%@BETWEEN[
delims,
string]
delims | exactly two characters, one start and one end delimiter |
string | the string to parse |
You generally do not need to quote or escape the delims string; the first two characters found are assumed to be the start and end delimiter characters, and the third must be a comma. (Exception: If you want to use a close bracket as a delimiter, escape it.) To use the same character as both start and end delimiter, type it twice.
The function returns the portion of string between the start and end delimiters. If the start delimiter is not found in the string, an empty string is returned. If the start delimiter occurs more than once, the first one found is used. If the start delimiter is found but the end delimiter is not, everything after the start delimiter is returned.
echo %@between[<>,This is <only> a test.]
only
echo %@between["",Let's parse out a "quoted chunk" of text.]
quoted chunk