This function extracts the first phrase matching a given regular expression in a block of text. One use of this is to extract information from free text fields in the current or in a previous episode.

For example, suppose that we defined a Calculated Value Attribute to have name Hormone and formula

first match in Report1 of “detected: ([0-9]*) mml”

then Hormone would be evaluated from the value of the Report1 attribute as follows in the case fragment below:

           01 Jun 03    20 Jun 03    02 Nov 03
Report1                              Hormone value detected: 657 mml
Report2                              Total IgE: not detected
Hormone                              657

This function works as follows. The block of text is searched to see if it matches the regular expression. If there is a match, then the part of the match inside the round brackets in the regular expression is returned.

The search for the matching text is case sensitive.

Note: There is a variant of this function, first match in … of … else – if no match which returns ‘-‘ rather than a blank when the pattern is not matched.

Note: this function makes advanced use of regular expressions. For more help, please contact PKS.

See also:

text of … between

text between

text before

text after

matches

exactly matches