regexpSplit()
The function "regexpSplit()" provides pattern matching via regular expressions.
Synopsis
int regexpSplit(string rexexp, string line, dyn_string &result, [mapping
                    options];
| Parameter | Description | 
|---|---|
| rexexp | 
                                 The regular expression. For permitted characters, see Qt - Regular Expression - Captured Texts under "Characters and Abbreviations for Sets of Characters". E.g.  This example searches for letters a-z and A-Z and the + sign searches the letter one or more times meaning the + sign stands for at least one-time repetition. With the expression "[a-z|A-Z]+", for example, you can separate letters from numbers.  | 
                        
| line | The string that is checked. | 
| result | The result of the search. | 
| options | 
                                 The options applied to the split. For the mapping the following keys can be used: 
  | 
                        
Return value
- The function returns >=0 (Position of the match) when a match was successfully found.
 - The function returns -1 if no match was found.
 - The function returns -2 when the regular expression contains an error. Errors can be retrieved by using the function getLastError().
 - The function returns -3 when the function contains wrong arguments.
 
Errors
See return values -2 and -3 above.
Details
The function "regexpSplit()" provides pattern matching via regular expressions. The function searches for the match of the specified character(s) and separates them from the string.
The first example searches for letters in the string "This?is6a55Test:=regexSplit### Function" and outputs the letters:
WCCOAui1:[dyn_string 1 items
WCCOAui1:     1: "This"
WCCOAui1:]["This"]
WCCOAui1:[dyn_string 1 items
WCCOAui1:     1: "is"
WCCOAui1:]["is"]
WCCOAui1:[dyn_string 1 items
WCCOAui1:     1: "a"
WCCOAui1:]["a"]
WCCOAui1:[dyn_string 1 items
WCCOAui1:     1: "Test"
WCCOAui1:]["Test"]
WCCOAui1:[dyn_string 1 items
WCCOAui1:     1: "regexSplit"
WCCOAui1:]["regexSplit"]
WCCOAui1:[dyn_string 1 items
WCCOAui1:     1: "Function"
WCCOAui1:]["Function"]
            The second example separates the words that were separated via \, from the string (Text) "Etm Company\twww.etm.at\tAustria" and outputs them:
WCCOAui1:     1: [dyn_string 4
    items
WCCOAui1:     1: "Etm Company
          www.etm.at      Austria"
WCCOAui1:     2: "Etm Company"
WCCOAui1:     3: "www.etm.at"
WCCOAui1:     4: "Austria"
            main(mapping event)
{
  dyn_string
  result;
  int i = 0;
  string s;
  while( i >= 0 )
  {
   i = regexpSplit("[a-z|A-Z]+", ""This?is6a55Test:=regexSplit###Function"", result, makeMapping("startPosition", i + strlen(s)));
   s = dynlen(result) > 0 ? result[1] : "";
   DebugN(result,  s);
   delay(0, 100);
  }
  dyn_string
  result;
  DebugN(regexpSplit("^([^\t]+)\t([^\t]+)\t([^\t]+)$", "Etm Company\twww.etm.at\tAustria", result));
  DebugN(result);
}
        Assignment
Regular expressions