Wild character in API search

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.

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.

1 Like

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?

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.

2 Likes

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.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.