Text.BetweenDelimiters
This function retrieves the text located between the specified startDelimiter and endDelimiter. It also allows optional input for a numeric startIndex to specify which instance of the startDelimiter t...
Text.BetweenDelimiters(text as nullable text, startDelimiter as text, endDelimiter as text, optional startIndex as any, optional endIndex as any) as any
This function retrieves the text located between the specified startDelimiter and endDelimiter. It also allows optional input for a numeric startIndex to specify which instance of the startDelimiter to consider. Additionally, an optional list startIndex can be provided to indicate both the instance of the startDelimiter to consider and whether indexing should start from the beginning or end of the input. The endIndex operates in a similar manner, but indexes are determined relative to the startIndex.
Extract the text enclosed within the first set of parentheses in the given string "111 (222) 333 (444)".
Usage:
Power Query MText.BetweenDelimiters("111 (222) 333 (444)", "(", ")")
Output:
"222"
Extract the text enclosed within the second set of parentheses, counting from left to right in the given string "111 (222) 333 (444)".
Usage:
Power Query MText.BetweenDelimiters("111 (222) 333 (444)", "(", ")", 1, 0)
Output:
"444"
Retrieve the text enclosed within the second set of parentheses from the end and the corresponding parentheses in the given string "111 (222) 333 (444)".
Usage:
Power Query MText.BetweenDelimiters("111 (222) 333 (444)", "(", ")", {1, RelativePosition.FromEnd}, {1, RelativePosition.FromStart})
Output:
"222) 333 (444"