section

Returns a section of string between two key values.

Input Parameters:

{{ input | section: '<beginning key>', '<ending key>', '<nth occurrence of beggining key (optional)>', '<nth occurrence of ending key (optional)>' }}

Examples:

Input

{{ 'use the keys to find a section of text and cut out the text between two keys.' | section: 'find a ', ' and' }}
{{ 'use the keys to find a section of text and cut out the text between two keys.' | section: 'text', 'two', 2 }}
{{ 'use the keys to find a section of text and cut out the text between two keys.' | section: 'keys ', ' text', 1, 2 }}

Output

section of text
 between 
to find a section of text and cut out the 

If the nth occurrence of beginning key is not found, an empty value will be returned.

Input

{{ 'use the keys to find a section of text and cut out the text between two keys.' | section: 'keys', 'text', 3 }}

Output

If the nth occurrence of ending key is not found, the remaining input will be returned.

Input

{{ 'use the keys to find a section of text and cut out the text between two keys.' | section: 'keys', 'text', 1, 5 }}

Output

 to find a section of text and cut out the text between two keys.

Last updated