--- title: "regexExtract()" slug: "string-regex-extract" updated: 2026-08-17T07:56:50Z published: 2026-08-17T07:56:50Z canonical: "docs.lobstersoftware.com/string-regex-extract" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # regexExtract() This function extracts all groups of a regular expression into a map (will be emptied before) if the expression matches. The return value of the function is the number of matches. ## Parameters | Parameter | Description | | --- | --- | | a | The text to which the regular expression is applied. | | b | The regular expression (with groups). | | c | Name of the map. | | d | (optional) Number of the group whose value is used as a key for the entries in the map. Default: Internal counter (starts with*1*). | | e | (optional) The separator used in the values of the map entries between the individual group values. Default: ; | ## Example | **Parameter a** | Mandatory value '9' not found for field 'F3055' and segment '/SG2/NAD', last xpath=/SG2[1]/NAD[1]/C082[1]/F3055-1[1] (record=1) Mandatory value '9' not found for field 'F3055' and segment '/SG2/NAD', last xpath=/SG2[2]/NAD[1]/C082[1]/F3055-1[1] (record=1) | | --- | --- | | **Parameter b** | ^Mandatory value '(.*?)' not found for field '(.*?)' and segment '(.*?)', last xpath=(.*?) \(record=1\).* | | **Parameter c** | mymap | | **Parameter d** | | | **Parameter e** | | ## Result As a result you get the return value *2* and the following entries in the map. **NOTE:** The value in parameter **a** is a simplified representation. To generate multiline values, use the function "concat()" beforehand. | 1='Mandatory value '9' not found for field 'F3055' and segment '/SG2/NAD', last xpath=/SG2[1]/NAD[1]/C082[1]/F3055-1[1 (record=1);9;F3055;/SG2/NAD;/SG2[1]/NAD[1]/C082[1]/F3055-1[1]' 2='Mandatory value '9' not found for field 'F3055' and segment '/SG2/NAD', last xpath=/SG2[2]/NAD[1]/C082[1]/F3055-1[1] (record=1);9;F3055;/SG2/NAD;/SG2[2]/NAD[1]/C082[1]/F3055-1[1]' | | --- |