--- title: "replace()" slug: "string-replace" updated: 2026-08-17T07:59:29Z published: 2026-08-17T07:59:29Z canonical: "docs.lobstersoftware.com/string-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. # replace() This function replaces every occurrence of **b** in text **a** with text **c**. Search and replacement text can be specified as a regular expression. If no regular expression is used, newline and tabulator characters can be specified with "\NL" and "\TAB". ## Parameters | Parameter | Description | | --- | --- | | a | Text. | | b | Search text. | | c | Replacement text. | | d | (optional) Use "true" if the search and replace text is a regular expression. Default: "false". | ## Examples | Parameter a | Parameter b | Parameter c | Parameter d | Result | | --- | --- | --- | --- | --- | | aaaa | a | 1 | | 1111 | | abcabc | abc | \TAB | false | (Two tabs.) | | abcabc | abc | \CR\NL | false | (Two linebreaks.) | | Firstname Surname | (\S+)\s+(\S+) | $2, $1 | true | Surname, Firstname | | Testphone: +49 (8158) 47-11 | [^\+\d] | | true | +4981584711 |