Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
RegEx.DataDetector
Performs data detection to find details in text.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
RegEx | 11.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
CheckingType | What type of data to look for. Can be a combination of Date, Address, Link, PhoneNumber or TransitInformation. |
"Address, PhoneNumber" |
Text | The text to check. | "Phone us at (555)555-555 later!" |
Result
Returns JSON or error.
Description
Performs data detection to find details in text.Based on Apple's data detector framework, we can identify valuable information in texts.
We return results as JSON array with an entry for each item found.
All result items include the type, text, position and length.
Date results include the Date, DateGMT, Duration and TimeZone entries. Date should be localized for FileMaker and DateGMT is standard SQL format for GMT.
The address result may include Name, JobTitle, Organization, Street, City, State, ZIP and Country.
You may run this from Windows or iOS with PSoS on a macOS server.
Examples
Find a phone number:
MBS( "RegEx.DataDetector"; "PhoneNumber"; "Phone us at (555)555-555 later!" )
Example result:
[
{
"length" : 12,
"position" : 13,
"text" : "(555)555-555",
"type" : "PhoneNumber",
"PhoneNumber" : "(555)555-555"
}
]
Find date:
MBS( "RegEx.DataDetector"; "Date"; "Call me tomorrow at 8pm later." )
Example result:
[
{
"length" : 15,
"Duration" : 0,
"position" : 9,
"Date" : "21.02.2021 20:00",
"text" : "tomorrow at 8pm",
"TimeZone" : null,
"type" : "Date",
"DateGMT" : "2021-02-21 19:00:00 +0000"
}
]
Find a link:
MBS( "RegEx.DataDetector"; "Link"; "Visit http://www.mbsplugins.eu/ to learn more." )
Example result:
[
{
"length" : 25,
"position" : 7,
"text" : "http:\/\/www.mbsplugins.eu\/",
"type" : "Link",
"URL" : "http:\/\/www.mbsplugins.eu\/"
}
]
Find an address:
MBS( "RegEx.DataDetector"; "Address"; "Visit use at Apple Park, One Apple Park Way, Cupertino, CA 95014, United States to learn more." )
Example result:
[
{
"length" : 54,
"position" : 26,
"Street" : "One Apple Park Way",
"State" : "CA",
"ZIP" : "95014",
"text" : "One Apple Park Way, Cupertino, CA 95014, United States",
"Country" : "United States",
"type" : "Address",
"City" : "Cupertino"
}
]
Find transit information:
MBS( "RegEx.DataDetector"; "TransitInformation"; "Take LH444 or DL15 to Atlanta." )
Example result:
[
{
"length" : 5,
"position" : 6,
"Flight" : "444",
"text" : "LH444",
"type" : "TransitInformation"
},
{
"length" : 4,
"position" : 15,
"Flight" : "15",
"text" : "DL15",
"type" : "TransitInformation"
}
]
Find phone number and address in one text:
MBS( "RegEx.DataDetector"; "Address, PhoneNumber"; "abc Inc¶Mr. John Meyer¶Neuer Weg 50¶12345 Neuestadt¶¶Phone: 0123 456789¶Fax: 0123 456780" )
Example result:
[
{
"length" : 28,
"position" : 24,
"Street" : "Neuer Weg 50",
"ZIP" : "12345",
"text" : "Neuer Weg 50\r12345 Neuestadt",
"type" : "Address",
"City" : "Neuestadt"
},
{
"length" : 11,
"position" : 61,
"text" : "0123 456789",
"type" : "PhoneNumber",
"PhoneNumber" : "0123 456789"
},
{
"length" : 11,
"position" : 78,
"text" : "0123 456780",
"type" : "PhoneNumber",
"PhoneNumber" : "0123 456780"
}
]
Find date with duration:
MBS( "RegEx.DataDetector"; "Date"; "We are closed from 1st to 5th April." )
Example result:
[
{
"length" : 21,
"Duration" : 345600,
"position" : 15,
"Date" : "01.04.2021 12:00",
"text" : "from 1st to 5th April",
"TimeZone" : null,
"type" : "Date",
"DateGMT" : "2021-04-01 10:00:00 +0000"
}
]
Find an email:
MBS( "RegEx.DataDetector"; "Link"; "John Miller <John.miller@mbsplugins.de>" )
Example result:
[
{
"length" : 25,
"position" : 14,
"text" : "John.miller@mbsplugins.de",
"type" : "Link",
"URL" : "mailto:John.miller@mbsplugins.de"
}
]
Release notes
- Version 14.1
- Improved Data Detector example to include a contextual menu routine for showing actions based on RegEx.DataDetector function.
- Version 12.5
- Disabled debug logging left over in RegEx.DataDetector function.
- Version 11.1
- Added RegEx.DataDetector function.
Example Databases
Blog Entries
- MBS @ dotfmp 2024
- MBS @ FMTraining.TV - New examples for FileMaker MBS Plugin
- MBS FileMaker Plugin, version 14.1pr1
- Data Detectors as context menu
- Regular Expressions in FileMaker
- MBS FileMaker Plugin, June 2021 News
- MBS FileMaker Plugin 11.1
- FileMaker Developers in Southern California
- Video about MBS FileMaker Plugins 11.1
- MBS FileMaker Plugin 11.1
FileMaker Magazin
This function checks for a license.
Created 18th February 2021, last changed 25th January 2024