Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
RegEx.Quote
Quotes text for use in patterns.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
RegEx | 7.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "RegEx.Quote"; Text ) More
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" ) ]
Example result: "Hello\?\ \*test\*\ 123"
Release notes
- Version 7.5
- Added RegEx.Replace, RegEx.ReplaceAll and RegEx.Quote functions.
Blog Entries
This function checks for a license.
Created 17th October 2017, last changed 25th November 2017
