I would love it if Airtable had a formula to determine whether a string (or field reference containing a string) matched a given regular expression.
Google Sheets, for example, has the
REGEXMATCH() function. It takes a string/cell reference and a regex, and returns TRUE or FALSE based on whether a match is found.
This would be immeasurably useful. A couple ideas:
- Validate email addresses, phone numbers, URLs, IP addresses, and other types of strictly formatted data.
- Enforce record naming conventions. (Field isn’t capitalized? Doesn’t start with a number? Contains spaces? Output a warning in another special formula field!)
- Build filters with very specific rules. E.g. match URLs where a subdomain contains the word “blue”. (include http://blue.example.com and http://bluegreen.example.com, but not http://www.blueexample.com or http://example.com/blue.trick/)
Some of these are possible now with complicated sequences of FIND, LEFT, MID, RIGHT, and LEN. It’s hard to debug formulas built this way, however. Regex is compact, easy to test, and comparatively easier to read.