--- title: "regexGroupReplace()" slug: "string-regex-group-replace" updated: 2026-08-17T07:58:12Z published: 2026-08-17T07:58:12Z canonical: "docs.lobstersoftware.com/string-regex-group-replace" --- > ## 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. # regexGroupReplace() This function replaces the values of the groups specified in **c** (found by the regular expression **b** in string **a**) with the values in **d**. The result of the function is the modified string. ## Parameters | Parameter | Description | | --- | --- | | a | The string in which group values are to be replaced. | | b | The regular expression for finding the groups in **a**. | | c | List with numbers of the groups whose values are to be replaced. | | d | List with replacement values. | ## Example Given are the lists *mylist1={1,2}* and *mylist2={A,B}*. | 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 | mylist1 | | Parameter d | mylist2 | ## Result As a result you get the following string. **NOTE:** The value in parameter **a** is a simplified representation. To generate multiline values, use the function "concat()" beforehand. | Mandatory value 'A' not found for field 'B' and segment '/SG2/NAD', last xpath=/SG2[1]/NAD[1]/C082[1]/F3055-1[1] (record=1) Mandatory value 'A' not found for field 'B' and segment '/SG2/NAD', last xpath=/SG2[2]/NAD[1]/C082[1]/F3055-1[1] (record=1) | | --- |