Data Detectors for FileMaker
Have you wondered how this works?
Apple provides data detectors in their frameworks to identify those data bits. We just added a new function RegEx.DataDetector to use those in FileMaker. While you can do a lot with regular expressions yourself, these pre-built detectors are convenient to use as they are. Here is our new function:
MBS( "RegEx.DataDetector"; CheckingType; Text )
You tell what to look for, either Date, Address, Link, PhoneNumber or TransitInformation. You can combine those types and look for multiple things together. The plugin then uses Apple's framework and returns the result as JSON for you to inspect. Let's take an example:
MBS( "RegEx.DataDetector"; "PhoneNumber"; "Phone us at (123)456-789 later!" )
With this result:
[As you see we have a JSON array with results. Each result has always the text found with the position and length to define the range in the original text. Then we provide the type of item found and type specific information. For a phone number this is simply an entry PhoneNumber with the number. If you need to format the phone number, check Using libPhoneNumber for phone number formatting. For an address, you may see Name, JobTitle, Organization, Street, City, State, ZIP and Country listed. Date results come with date, time zone and duration while links comes with an URL.
{
"length" : 12,
"position" : 13,
"text" : "(123)456-789",
"type" : "PhoneNumber",
"PhoneNumber" : "(123)456-789"
}
]
Please try those functions later this week with our next pre-release and let us know how they work for you.