Extract
Description
Description
Extracts and returns an array of strings found.
Extracts and returns an array of strings found.
Syntax
Syntax
target.strlib.Extract( input, look_for, pos_len )
target.strlib.Extract( input, look_for, pos_len )
look_for: This is a regular expression
pos_len: array of two parallel arrays (optional) - position and length pairs
Return value
Return value
An array of strings found
Sample
'---------- Start ----------
Function Start
Dim str, arr
str = "The 23 goal 78 is 12 to 9 extract 55 only 102 the 8593 numbers 2929"
arr = target.strlib.Extract( str, "\d+" )
trg.Message( arr(4) )
End Function
In this case the goal is to extract the numbers from the input string. That is done using Extract and regular expression "\d+". Then all the extracted substrings are stored in an array and the 5th element, which would be "55", is being displayed.
See also