Formatter Features: Extracting Email + URL

  • 8 September 2021
  • 0 replies
  • 827 views
Formatter Features: Extracting Email + URL
Userlevel 4
Badge +7

Hey there Zapier friends! Continuing our exploration of the Formatter by Zapier app, let’s take a look at another set of very handy functions: Extract Email & URL

We’ve all been there — we have a great idea for an automation to create in Zapier and after we have thought and created the Zap of our dreams, we run into issues with our data being rejected by one or more of the actions.  

A Little Background

When it comes to URLs and email addresses, which characters are acceptable in each is defined by the rules developed by the international standards organization: Internet Engineering Task Force (IETF) 

The IETF defines the standards by which software and other internet technologies follow in order to ensure interoperability across computer systems. Anyone can access these standards documents, called RFCs, and we can find the defined standards for both email addresses and URLs for each via a quick Google search.

When it comes to standards on the internet, most APIs will follow most of these standards most of the time. When it comes to how APIs and underlying software confirm specific strings are of the correct format, like email addresses or URLs, they use something called Regular Expressions to verify and validate that the supplied inputs in an API request are what they expect. These rules tend to be very strict, and most APIs will usually return an error if you provide a URL or Address that contains something that is not acceptable according to the standards set in the RFCs for that particular input type.

Usually when an API rejects these strings, it is due to extra characters (like a trailing space or a preceding double quote for example) that are inadvertently included in the data being sent into Zapier from your trigger or action steps. We could write another article just to discuss the issue of “Dirty Data", as it is one of the biggest issues that folks have when it comes to using Zapier and other methods of automating work.  

 

Let’s just say that in some situations if your data is too dirty, there is little hope in setting up an automation without first standardizing this data (prior to sending it to Zapier). For example, if you are collecting Google Form submissions to send into Salesforce to create Contacts but did not require the “Email Address” field to be provided and some entries are missing this information, there is nothing that Zapier could do to help you solve this issue. You would first need to fix the issue at the source by making the field required, and then update the existing records with the email addresses, and then re-trigger the Zap via our import/export methods.

For (almost) everything else, enter Formatter by Zapier!

Formatter by Zapier: Extract Email Address

This option can be found at:
Formatter by Zapier — Text — Extract Email Address

b96bafee0b6b91c8f0f8a49cc0fcc891.png

What It Looks Like

This transform only has one field, where you input the text from which you'd like to extract the email address.

12a9a937a621ce7a749f9f6715c8eb23.png

How to Use It

When we get data from other members on our team, submitted in various ways through different methods, it is a very common issue for data to be provided in a less-than-ideal format. For example, in this screenshot of the editor, the data we were sent contains a double quote in the front of the address:

ca3d1c43b0039f5b2c78071d4d75e15f.png

When you or I look at that, we as humans know to ignore the double quote, but if you are sending this into an action that requires an email address, the recipient API will take the data provided to it literally. If it contains a character like this, more often than not the request will be rejected due to an invalid email address.

Once we run the Extract Email Address function, we see that all of the invalid characters are removed:

75d483eaaa2308170a72453bd5b84253.png

Keep in mind:

  • When it comes to any step in Zapier, unless explicitly stated in the description of the trigger/action step in question, Zapier will only ever perform a single action or (in the case of Find steps) return a single object. 

  • Formatter by Zapier will only ever extract the first item we find in the data provided. In this example, if you send as input a large block of text with multiple email addresses, Zapier will only extract the first one we find.  

  • If you needed to extract multiple objects, one could look into using a few Split Text transforms or using the Match Pattern transform, both of which are also offered in the Formatter by Zapier Text actions.

  • Most malformed email addresses are due to extra characters being added to the beginning or the end of the provided string. Should the invalid characters be found in the middle of an email address, using this step will NOT return a valid email address. We will cut it wherever the invalid character is found and return the remaining string. You would need to solve this type of problem outside of Zapier first should you run into it.

Extract URL

This option can be found at:
Formatter by Zapier — Text — Extract URL

015917d7de03b9595043b6f681c506bb.png

What It Looks Like

This transform only has one field, where you input the text from which you'd like to extract the URL.

de3d3b43dc81b436a25299f7ca6ff8f9.png

How to Use It

The most common use of a step like this would be to take data coming from a body of an email or post to a social media app and to extract the first URL we find in the content. For example, let’s say I know in the body there will always exist a single URL, then I can map that body output from my prior step:

4f3fde747174206a7758a590db8d63aa.png

...and then I can have access to the URL on its own, to pass into a field that requires a valid URL address as input.

In the case of dirty data, we can also use this step to not only remove any non-standard characters that may be attached to the URL, but Zapier can also pass along the URL Parameters as well should the URL include them:

af1e3bf78ce23ca30772deebb5a3b99b.png

=>

08b810d15e916fd6aed984988fa56d84.png

Coming Up in the Series

Hope you've found this look at email and URL extraction via the Formatter helpful. Next up in the Formatter Features series we'll be taking a look at extracting numbers and phone numbers. Until then...happy zapping!


0 replies

Be the first to reply!

Reply