Click or drag to resize

Regex function

Regex function search for matches of a regex string in a string and return a collection of matches separated by an empty space.

Syntax

Default syntax: [var] = regex "{string}" "{pattern}".

//Initializing the Regular Expression
[reg] = regex "This is a text string. Let's find all the text between the parenthesis: (a) (hello) (test)" "\([^\(|\)]*\)"

//Read the first word in the string and save in the first element of the "var" vector
[var0] = next [reg]

//while the string is not void, reads all the values of data and saves in an array
[i] = 0
loop not(streq "{var{i}}" "") then
  [i]++
  [var{i}] = next [reg]
endloop

//Now all the matches are saved in the "var" vector.