RichText.ReplaceTexts
---------------------

Replaces text in current rich text document with new text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RichText](component_RichText.md) | [6.4](newinversion64.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "RichText.ReplaceTexts"; SearchTextList; NewTextList { ; Multiple } ) 

**MBS**( **"RichText.ReplaceTexts";** /\* Replaces text in current rich text document with new text. \*/  
**$SearchTextList**; /\* The list of texts to search. Search is case insensitive.e.g. "$FirstName" \*/   
**$NewTextList**; /\* The list of new text to use as replacement. Can be empty.e.g. "Christian" \*/   
**$Multiple**) /\* Optional; Optional, Pass 1 to replace all occurrences. Default is 0 to replace the first one found.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| SearchTextList | The list of texts to search. Search is case insensitive. | "$FirstName" |  |
| NewTextList | The list of new text to use as replacement. Can be empty. | "Christian" |  |
| Multiple | Optional, Pass 1 to replace all occurrences. Default is 0 to replace the first one found. | 0 | Optional |

### Result

Returns OK or error.

### Description

Replaces text in current rich text document with new text.  
While [RichText.ReplaceText](RichTextReplaceText.md) replaces just one value, this function can replace a list of value.  
This can be used to load Word file (DOC, RTF, DOCX), replace place holders with values for client and save a personalized copy.  
### Examples

Replaces text to test function:

 Let ( \[  
r1 = MBS ( "[RichText.ReadText](RichTextReadText.md)"; "Hello World. Greetings from FileMaker."; "UTF-8" );  
r2 = MBS ( "RichText.ReplaceTexts"; "Hello¶World¶from¶FileMaker¶Greetings"; "Hallo¶Leute¶aus¶FileMaker!¶Grüße"; 0 );  
r = MBS ( "[RichText.Text](RichTextText.md)" );  
r3 = MBS ( "[RichText.Clear](RichTextClear.md)" )  
\];r )  
### See also

- [RichText.Clear](RichTextClear.md)
- [RichText.ReadText](RichTextReadText.md)
- [RichText.ReplaceText](RichTextReplaceText.md)
- [RichText.Text](RichTextText.md)

This function is free to use.

Created 25th September 2016 , last changed 25th September 2016

  
[RichText.ReplaceText](RichTextReplaceText.md) - [RichText.SetAttribute](RichTextSetAttribute.md)

[HTML Version](RichTextReplaceTexts.shtml)