Matrix.SearchAndReplace
-----------------------

Searches and replaces text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Matrix](component_Matrix.md) | [16.2](newinversion162.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Matrix.SearchAndReplace"; MatrixRef; Search Text; Replace Text { ; firstRow; LastRow; firstCol; lastCol } ) 

**MBS**( **"Matrix.SearchAndReplace";** /\* Searches and replaces text. \*/  
**$MatrixRef**; /\* The matrix reference number.e.g. $matrix \*/   
**$Search Text**; /\* The text to search.e.g. "Hello" \*/   
**$Replace Text**; /\* The text to replace with.  
Can include styled text.e.g. "Hallo" \*/   
**$firstRow**; /\* Optional; The index of first row.  
Default is 0.e.g. 0 \*/   
**$LastRow**; /\* Optional; The index of last row.  
Default is [Matrix.Height](MatrixHeight.md)-1.e.g. 5 \*/   
**$firstCol**; /\* Optional; The index of first column.  
Default is 0.e.g. 0 \*/   
**$lastCol**) /\* Optional; The index of last column.  
Default is [Matrix.Width](MatrixWidth.md)-1.e.g. 6 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| MatrixRef | The matrix reference number. | $matrix |  |
| Search Text | The text to search. | "Hello" |  |
| Replace Text | The text to replace with.   Can include styled text. | "Hallo" |  |
| firstRow | The index of first row.   Default is 0. | 0 | Optional |
| LastRow | The index of last row.   Default is [Matrix.Height](MatrixHeight.md)-1. | 5 | Optional |
| firstCol | The index of first column.   Default is 0. | 0 | Optional |
| lastCol | The index of last column.   Default is [Matrix.Width](MatrixWidth.md)-1. | 6 | Optional |

### Result

Returns OK or error.

### Description

Searches and replaces text.  
### Examples

Search and replace some text:

 Let (\[  
 // split a CSV  
 matrix = MBS ( "[Matrix.CSVSplit](MatrixCSVSplit.md)"; "FirstName;LastName;City¶Joe;Miller;Las Vegas¶Bob;\\"Johnson-Meyer\\";\\"Köln\\"");  
 // swap first and second row  
 r = MBS ("Matrix.SearchAndReplace"; matrix; "ö"; "oe");  
 // and ask for text back with column names in first row  
 text = MBS ("[Matrix.CSV](MatrixCSV.md)"; matrix);  
 r = MBS ("[Matrix.Release](MatrixRelease.md)"; matrix)  
\]; text )  
### See also

- [Matrix.CSV](MatrixCSV.md)
- [Matrix.CSVSplit](MatrixCSVSplit.md)
- [Matrix.Height](MatrixHeight.md)
- [Matrix.Release](MatrixRelease.md)
- [Matrix.Width](MatrixWidth.md)

### Release notes

- **Version 16.2**
    - Added [Matrix.SearchAndReplace](https://www.mbsplugins.eu/MatrixSearchAndReplace.shtml), [Matrix.SwapColumns](https://www.mbsplugins.eu/MatrixSwapColumns.shtml) and [Matrix.SwapRows](https://www.mbsplugins.eu/MatrixSwapRows.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin 16.2 News](https://www.mbsplugins.de/archive/2026-05-20/MBS_FileMaker_Plugin_162_News/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 16.2 für Claris FileMaker](https://www.mbsplugins.de/archive/2026-05-05/Neues_MBS_Plugin_162_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 16.2 for Claris FileMaker](https://www.mbsplugins.de/archive/2026-05-05/MBS_Plugin_162_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.2pr1](https://www.mbsplugins.de/archive/2026-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 22nd March 2026 , last changed 22nd March 2026

  
[Matrix.Rotate](MatrixRotate.md) - [Matrix.SetColumn](MatrixSetColumn.md)

[HTML Version](MatrixSearchAndReplace.shtml)