Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
RegEx.ReplaceAll
Replaces patterns.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
RegEx | 7.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Text | The text to use. | "hello world" | |
Pattern | The pattern to use. | "l+" | |
Rewrite | The output pattern. | "\1\1" | |
Options | The PCRE options. Can be given as text or number. |
0 | Optional |
Result
Returns new text or error.
Description
Replaces patterns.You can replace the all occurrences of pattern in text with rewrite pattern. Within rewrite pattern, backslash-escaped digits (\1 to \9) can be used to insert text matching corresponding parenthesized group from the pattern. \0 in rewrite refers to the entire matching text.
Replacements are not subject to re-matching.
Examples
Replace all:
MBS( "RegEx.ReplaceAll"; "yabba dabba doo"; "b+"; "d" )
Example result: "yadda dadda doo"
Replace all greedy:
MBS( "RegEx.ReplaceAll"; "yabba dabba doo"; "b+"; "d"; "greedy" )
Example result: "yada dada doo"
Replace links with html:
MBS( "RegEx.ReplaceAll"; "This is a link to the Monkeybread Software site: http://www.mbsplugins.eu/ where Filemaker solutions can be found."; "(https?://[\w./]+)"; "<a href=\"\1\">\1</a>"; "caseless¶greedy" )
Example result: This is a link to the Monkeybread Software site: <a href="http://www.mbsplugins.eu/">http://www.mbsplugins.eu/</a> where Filemaker solutions can be found.
Replace all σ with ς in greek texts:
MBS( "RegEx.ReplaceAll"; "Ιωαννησ testσ testσ"; "([\p{Greek}\p{Latin}]+)σ(\W*)"; "\1ς\2" )
See also
Release notes
- Version 7.5
- Added RegEx.Replace, RegEx.ReplaceAll and RegEx.Quote functions.
Example Databases
Blog Entries
- MBS Plugin Advent calendar: 19 - RegEx
- Regular Expressions in FileMaker
- Text to Webviewer Script for FileMaker
- MBS FileMaker Plugin, version 7.5pr3
This function checks for a license.
Created 17th October 2017, last changed 23th July 2018