How do you find a phone number or a username in the middle of a string? Sometimes you can use the Formatter Split text function, if the item will always be in the same place, but it’s not always that straight forward.
That’s where the Extract Pattern function for the Formatter app comes in. You can find the Extract Pattern transform under the ‘Text’ functions for the Formatter. What it allows you to do is to find and extract patterns in text.
The Extract Pattern function uses Regex to find the text that you need. Regex is short for ‘regular expression’ and it basically means that you’re giving a sample format for the step to find.
You can learn more about Regex, including seeing a few examples in our blog post: How to Extract Email Addresses, Phone Numbers, and Links From Text
The post also has some useful resources, like the Regex wikipedia page, which explains the syntax (rules) of Regex.
Extract pattern is useful for pulling out user names, specific email or phone number types (eg emails from a specific domain).
Have you used Extract pattern before? Do you have an example that you can share with the community?
How about this: lets say you have a list of phone numbers:
0123-555-6789, 0123-555-4321, 0729-555-1234, 0123-555-891
And you want to extract any number that starts ’07’. The 07 number might appear anywhere in the list of numbers, so how would you get it?
How might you solve that using regex?