RegEx.Quote
-----------

Quotes text for use in patterns.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RegEx](component_RegEx.md) | [7.5](newinversion75.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "RegEx.Quote"; Text ) 

**MBS**( **"RegEx.Quote"** /\* Quotes text for use in patterns. \*/  
**$Text**) /\* The text to quote. e.g. "Hello." \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Text | The text to quote. | "Hello." |

### Result

Returns text or error.

### Description

Quotes text for use in patterns.  
Escapes all potentially meaningful regexp characters in text. The returned string, used as a regular expression, will exactly match the original string. For example, "1.5-2.0?" may become: "1\\.5\\-2\\.0\\?".  
  
Note QuoteMeta behaves the same as perl's QuoteMeta function, \*except\* that it escapes the NUL character (\\0) as backslash + 0, rather than backslash + NUL.  
### Examples

Escape a test string:

 Show Custom Dialog \[ "RegEx escaped" ; MBS ( "RegEx.Quote"; "Hello? \*test\* 123" ) \]  
<small>  
Example result: "Hello\\?\\ \\\*test\\\*\\ 123"</small>### Release notes

- **Version 7.5**
    - Added [RegEx.Replace](http://www.mbsplugins.eu/RegExReplace.shtml), [RegEx.ReplaceAll](http://www.mbsplugins.eu/RegExReplaceAll.shtml) and [RegEx.Quote](http://www.mbsplugins.eu/RegExQuote.shtml) functions.

### Blog Entries

- [Regular Expressions in FileMaker](https://www.mbsplugins.de/archive/2023-03-19/Regular_Expressions_in_FileMak/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.5pr3](https://www.mbsplugins.de/archive/2017-10-23/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 17th October 2017 , last changed 25th November 2017

  
[RegEx.Pattern](RegExPattern.md) - [RegEx.Release](RegExRelease.md)

[HTML Version](RegExQuote.shtml)