Multiline String, Get Range Lines
Extracts the specified range of rows. The range is specified by Begin Index and End Index. The index is zero-based and the index on the first row is zero. Note that the row specified by the End Index is not included in the range.
Download
- Multiline-String-Get-Range-Lines-2021.xml
- 2021-08-29 (C) Questetra, Inc. (MIT License)
- Multiline-String-Get-Range-Lines-2023.xml
- 2023-08-21 (C) Questetra, Inc. (MIT License)
- for “GraalJS standard (engine-type 3)” on v15.0 or above
The Add-on import feature is available with Professional edition.
Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.
Notes
- When the process reaches this automated task, the Text in the string data is automatically processed.
- TSV data, Access log, Email body, etc.
- {Number of lines} = {Number of line breaks} + 1
- The range specified by the start line (Begin Index) and end line (End Index) is extracted.
- Index starts at zero. The Index on the first line is “0”. (10-line text: 0,1,2,3,4,5,6,7,8,9)
- If there is a negative value for Index, it will be interpreted as a subtraction from the number of lines.
- If “-1” is specified in 10 lines of text, it is the same as if “9” is specified.
- End Index is optional. If omitted, the entire part will be extracted.
- Even if End Index is specified to exceed the Index of the last row, the end will be extracted.
- A case where an empty string is returned.
- {Begin Index} >= {End Index}
- {Begin Index} > (Index of the last line)
- Example of range specification
- Extract the first 5 lines (0,1,2,3,4,5,,, to 0,1,2,3,4):
- {Begin Index}:
0
- {End Index}:
5
- {Begin Index}:
- Extract only the 3rd line (0,1,2,3,4,5,,, to 2):
- {Begin Index}:
2
- {End Index}:
3
- {Begin Index}:
- Delete one first line (header row) (0,1,2,3,,,N to 1,2,3,,,N):
- {Begin Index}:
1
- {End Index}: (empty)
- {Begin Index}:
- Delete one last line (footer row) (0,1,2,,,N-1,N to 0,1,2,,,N-1):
- {Begin Index}:
0
- {End Index}:
-1
- {Begin Index}:
- Extract the first 5 lines (0,1,2,3,4,5,,, to 0,1,2,3,4):
- Index starts at zero. The Index on the first line is “0”. (10-line text: 0,1,2,3,4,5,6,7,8,9)
Capture


Appendix
- The range specification is the same as the JavaScript
slice ()
method. - 10-line text:0,1,2,3,4,5,6,7,8,9
- {Begin Index}:
-10
- Output Line: 0,1,2,3,4,5,6,7,8,9
- {Begin Index}:
5
, {End Index}:20
- Output Line: 5,6,7,8,9
- {Begin Index}:
- When setting an index by referring to numeric, set an EL expression using arithmetic operations.
- Extract only (N+1) line; (Index N)
– {Begin Index}:#{#q_numN}
– {End Index}:#{#q_numN + 1}
- Extract only (N+1) line; (Index N)
Pingback: Multiline String; Delete Header Lines – Questetra Support
Pingback: Multiline String; Delete Footer Lines – Questetra Support
Pingback: Multiline String, Get Specific Line – Questetra Support