syntax:functions:replacebetweenmany
Table of Contents
ReplaceBetweenMany(text, string1, contents, string2 [,N])
Category: Text function
Description
This function replaces in text the first N occurrences (or last N occurrences if a negative value is used) of any text between string1 and string2 with contents.
Use cases
This function can be used for patching or editing HTML/XML data.
Arguments
Argument | Type | Description |
---|---|---|
text | Text (must not be empty) | The initial text value. |
string1 | Text (must not be empty) | The text string that defines the starting point of the text to be replaced. |
string2 | Text (must not be empty) | The text string that defines the ending point of the text to be replaced. |
contents | Text (must not be empty) | The text string to be inserted between string1 and string2, replacing any existing text. |
N | Number (optional) | The first (or last, if negative) number of occurrences to replace. If omitted, N defaults to 1. |
Return value type: Text
Remarks
This function is case-sensitive.
text, string1, string2 and contents are implicitly converted to text values if required.
If neither string1 nor string2 is not found within text, the original text string is returned.
Examples
replacebetweenmany('<a><b>', '<', 'c', '>', 2) //Returns '<c><c>'
replacebetweenmany('<a><b>', '<', 'c', ']' ) //Returns '<a><b>' ( ']' not found )
See also
syntax/functions/replacebetweenmany.txt · Last modified: 2025/03/18 16:49 by craigt