Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Dec 27, 2021 09:53 PM
Currently, I am using the API to get record(s) information. I have a query like this:
filterByFormula=Search(‘478-1160-1’,Upper({MD Part Number}))
which the syntax is working either by returning 1 or more records. However, I am wondering if there is a wild character that I can pass in case that instead of “dashes” there is spaces or other character. So I can do something like:
filterByFormula=Search(‘478%1160-1’,Upper({MD Part Number}))
Thanks in advance.
Dec 28, 2021 01:15 PM
You can use the REGEX_MATCH(string, regex)
regular expression function in filterByFormula
. Writing regular expressions can take a bit of getting used to, but they are very powerful. This support article has more information, including links to regex testing websites.
Dec 28, 2021 04:36 PM
Yesterday I noticed this and started to play with it. But it doesn’t work, it keeps returning all kind of records when I am only trying to return one specific record. Do you have any official documentation on how to use it?
Dec 28, 2021 09:20 PM
The links in @kuovonne’s response point to some good resources. Regular expression syntax is somewhat universal, but there are variations depending on where it’s been implemented. If you use Regex101.com (one of the sites listed in the support article linked above), pick the Golang variant on the left, which is the closest match for what Airtable uses.
My recommendation would be to test your regular expression on a site like that before trying it in Airtable. Copy and paste some of the actual part numbers into various rows in the “Test string” section, and maybe change some to uses spaces or other characters instead of hyphens. Then work on crafting a regular expression that will match all rows. Once you’ve got it, copy the expression and paste it into the REGEX_MATCH()
function:
filterByFormula=REGEX_MATCH({MD Part Number}, "your_expression_here")
If you can’t quite get it working, please share the details of what you’re trying and we can guide you in the right direction.
Dec 29, 2021 08:25 AM
Thank you. I am going to give it a chance. I am looking forward in using it to find “hard to get” records in our tables.