360Works Patterns User Guide

The RegEx plugin provides advanced regular expression support for Filemaker. Includes support for splitting, replacing, and highlighting text based on a regular expression.
A good overview of regular expression syntax can be found here.

Registering the plugin

The RegEx plugin will not function unless it has been registered with the regexRegister function. Create a new startup script which registers the plugin:
Set Field [plugin registration result ; regexRegister("DEMO" ; "My Company")]
# Use a valid license key here if you have one!
# The 'DEMO' license key will expire after 2 hours.
Then in the "File Options" menu, check the "Perform Script" checkbox in the "When Opening This File" section and select your registration script.

Using the plugin

Consult the "RegEx Example.fp7" Filemaker file which contains examples of plugin usage.

Installation

Requirements

FileMaker version 7 or higher.

Java Virtual Machine (JVM) version 1.4.2 or later. If you are running a JVM earlier than 1.4.2, you should upgrade. Download a JVM from http://www.java.com/en/download/. If you are not sure what version of Java you have installed, you can do 'java -version' on the command line in Windows or OS X.

Windows, or Mac OS X version 10.4 or higher.

Note to intel Mac users: running this plugin under Rosetta is not supported. Upgrade to FileMaker 8.5 to run our plugin in native Intel mode.

Install Steps for FileMaker Pro

Drag the plugin from the MAC or WIN folder into your FileMaker extensions, and restart FileMaker. You will need to enter your license key before you can use it. After FileMaker starts up with the plugin installed, open FileMaker preferences, click on the Plug-ins tab, select the plugin from the list, and click the Configure button. Enter your license key and company name in this dialog. You will only need to do this once on a given machine. Alternately, you can use the registration function to register the plugin during a startup script.

This will also enable the plugin for use with Instant Web Publishing from the FileMaker Pro client software.

If the plugin does not load correctly, double-check that you meet the system requirements.

Install steps for FileMaker Web Publishing Engine / Instant Web Publishing

You do not need to do this step unless you plan on using the plugin with Instant Web Publishing or Custom Web Publishing with FileMaker Server Advanced. You will need an Enterprise License to use this feature.

For installing into the Web Publishing Engine with FileMaker 9 Server or FileMaker Server Advanced, drag the plugin from the MAC or WIN folder into the FileMaker Server/Web Publishing/publishing-engine/wpc/Plugins folder. If there is no 'Plugins' folder inside the 'wpc' folder, then create it manually. Restart FileMaker Web Publishing, and now the plugins should be ready to go.

Note that you must use the registration function to register the plugin, since there is no preferences dialog in the FileMaker Web Publishing Engine to enter the license key and company name.

Note that due to a bug which we and other plugin vendors have reported to FileMaker, web plugins do not work in FileMaker Web Publishing Engine 8.0v4 on Mac OS X. You will need to use a later version, like 9, or an earlier version, like 8.0v3. The Windows FileMaker Server 8.0v4 does not have this bug, and will work correctly.

The easiest way to test whether the plugin is working is to have a calculation which calls the version function of the plugin, and display that on an IWP layout. If it shows "?", then the plugin is not working. If it shows a number, then the plugin has been installed successfully.

Install steps for FileMaker Server 9

You do not need to do this step unless you plan on using the plugin with scheduled script triggering, a new feature in FileMaker Server 9. You will need an Enterprise License to use this feature.

  1. Drag the plugin from the MAC or WIN folder into the FileMaker Server/Database Server/Extensions folder (Server 8 and older versions of server use the path FileMaker Server/Extensions/Plugins).
  2. Restart FileMaker Server. In the Server Admin application, go to Configuration -> Database Server->Server Plug-ins.
  3. Check the box that says 'Enable FileMaker Server to use plug-ins', and then check the 'enabled' box for this plugin. You should now be able to write schedules that trigger scripts which use the plugin.

Note that you must use the registration function to register the plugin, since there is no preferences dialog in FileMaker Server to enter the license key and company name.

Feedback

We love to hear your suggestions for improving our products! If you are experiencing problems with this plugin, or have a feature request, or are happy with it, we'd appreciate hearing about it. Send us a message on our website, or email us!

Function Summary

Function Detail

regexLastError

Returns the last regex-related error which occurred, typically due to a badly formed regular expression.


regexLicenseInfo

Returns information about the license used.

Returns: The type of license the plugin is registered under.

regexMatchAll ( text; regex )

Returns a newline-delimited list containing pattern matches. Any text that is not a pattern match will be omitted.

Example of a function to extract a return-separated list of numbers from a string.

regexMatchAll("123 and 5321 are open, but 0121 is closed" ; "[0-9]+")
/* returns the following:
123
5321
0121
*/

Parameters:
input - input text
regex - regular expression pattern.
See also: regexSplit
Returns: Any pattern matches, separated by line breaks.

regexRegister ( licenseKey ; registeredTo )

Registers the Plugin.

Parameters:
licenseKey - a valid license key string, or the literal string "DEMO" to run in demo mode.
registeredTo - the company name for the license key used.
Returns: 1 on success, or "ERROR" on failure.

regexReplaceAll ( text; regex; replacement {; colorRGB ; styles ; size} )

Replace all occurrences of a regex with some replacement text. The replacement text can optionally be styled. Highlighting style is determined by the three optional parameters colorRGB, styles, and size. Consult the Filemaker TextStyleAdd and TextColor documentation for more details about named Filemaker text styles and colors.

Example of simple replace, converting one or more spaces to a single underscore character:

regexReplaceAll("The    quick     brown    fox", " +", "_")
// returns "The_quick_brown_fox"

Example of a highlighting replace operation, highlighting the literal string "quick":

regexReplaceAll("The quick brown fox" ;
    "quick" ;
    "quick" ;
    RGB(128 ; 128 ; 255) ;
    bold )
// returns The quick brown fox

Parameters:
text - The input text
regex - The regular expression
replacement - The text to replace the found occurrences with. This may contain backreferences.
colorRGB - The optional color to apply to highlighted text, e.g. RGB(200, 0, 0)
styles - The optional styles to apply to highlighted text, e.g. bold + underline.
size - The optional font size to apply to highlighted text, e.g. 15.
Returns: The input text with all occurrences of regex replaced with replacement

regexSplit ( text; regex )

Split a string around matches of the given regular expression. The actual pattern matches will be omitted from the result.

Parameters:
text - The input text
regex - The regular expression pattern.
See also: regexMatchAll
Returns: the input string with any matching blocks replaced with a newline.

regexVersion

Returns the version of the regex plugin which is installed.

Returns: an integer version number.