Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: Wild character in API search

1663 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_Jurado
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

RJ
4 Replies 4

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.

Robert_Jurado
5 - Automation Enthusiast
5 - Automation Enthusiast

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?

RJ

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.

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.

RJ