Titan



regexp


This function returns the substring of the input character string instr, which is the content of n-th group matching to the expression. In input string instr may be of any character string type. The type of the character string returned is the root type of instr. The expression is a character pattern. The number of the group to be returned is specified by groupno, which shall be a non-negative integer. Group numbers are assigned by the order of occurrences of the opening parenthesis of a group and counted starting from 0 by step 1. If no substring fulfilling all conditions (i.e. pattern and group number) is found within the input string, an empty string is returned.


Related keyword:


regexp(any_character_string_type instr, charstring expression, integer groupno) return character_string_type


Example 1:

  var charstring mypattern2 := ""
  var charstring myinput :=" date: 2001-10-20; msgno: 17; exp "
  var charstring mypattern := "[ \\t]#(,)date: [\\d\\-]#(,);[ \\t]#(,)msgno: (\\d#(1,3));[ \\t]#(,)(exp[ \\t]#(,))#(0,1)"

  // Then the expression
  var charstring mystring := regexp(myinput, mypattern, 0)
  //will return the value '17'.