Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

TextBetween - script and chart function

TextBetween() returns the text in the input string that occurs between the characters specified as delimiters.

Syntax:  

TextBetween(text, delimiter1, delimiter2[, n])

Return data type: string

Arguments
Argument Description
text The original string.
delimiter1 Specifies the first delimiting character (or string) to search for in text.
delimiter2 Specifies the second delimiting character (or string) to search for in text.
n Defines which occurrence of the delimiter pair to search between. For example, a value of 2 returns the characters between the second occurrence of delimiter1 and the second occurrence of delimiter2.
Example: Chart expressions
Example Result
TextBetween( '<abc>', '<', '>' ) Returns abc
TextBetween( '<abc><de>', '<', '>',2 ) Returns de
TextBetween( 'abc', '<', '>' )

Returns NULL

If any of the delimiter is not found in the string, NULL is returned.

TextBetween( '<a<b', '<', '>' )

Returns NULL

If any of the delimiters are not found in the string, NULL is returned.

TextBetween( '<>', '<', '>' ) Returns a zero-length string.
TextBetween( '<abc>', '<', '>', 2 )

Returns NULL, as n is greater than the number of occurrences of the delimiters.

Example - TextBetween fundamentals

Example - TextBetween scenario

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!