Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   8.0    Statistic  


Quotes text for use in patterns.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
RegEx 7.5 Yes Yes Yes Yes Yes

MBS( "RegEx.Quote"; Text )


Parameter Description Example value
Text The text to quote. "Hello."


Returns text or error.


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.


Escape a test string:

Show Custom Dialog [ "RegEx escaped" ; MBS( "RegEx.Quote"; "Hello? *test* 123" ) ]

Example result: "Hello\?\ \*test\*\ 123"

RegEx.Pattern   -   RegEx.Replace

Feedback: Report problem or ask question.

MBS Xojo Plugins