How to isolate address from a formatted text block in Zapier?

Hey folks, I’m working on a Zapier automation and could use some help. My zap gets contact info in a structured format, but I need to pull out just the address. The data looks like this:

Name: Jane Smith
Company: ABC Corp
Phone: 555-1234
Email: [email protected]
Address: 123 Main St, Anytown, ST 12345
Notes: Wants a quote for services

The info always comes in this block style with each field on its own line. I’m stumped on how to grab only the address line. Any Zapier wizards know a trick for this? I’ve tried a few things but can’t quite crack it. Thanks for any tips!

I’ve been in your shoes, and I know how tricky this can be. Here’s what worked for me: use Zapier’s ‘Line Item to Text’ action. It splits each line into separate items. Then, add a Filter step to only keep the line starting with ‘Address:’. Finally, use a Formatter step with ‘Text’ transform and ‘Remove Prefix’ to strip off ‘Address:’. This approach is flexible and works even if the order of lines changes. It’s saved me tons of time in similar situations. Give it a shot and let us know how it goes!

hey alexr1990, i’ve dealt with this before! try using the ‘Formatter’ step in Zapier. choose ‘Text’ as the transform type, then ‘Extract Pattern’. use this regex: Address: (.+). it’ll grab everything after ‘Address:’ for ya. hope that helps!

Another approach you might consider is using Zapier’s Code step. You can write a simple JavaScript function to parse the text block and extract the address. Here’s a basic example:

function extractAddress(input) {
  const lines = input.split('\n');
  const addressLine = lines.find(line => line.startsWith('Address:'));
  return addressLine ? addressLine.replace('Address:', '').trim() : '';
}

output = {address: extractAddress(inputData.text)};

This method is quite flexible and can handle variations in the input format. You’d just need to replace ‘inputData.text’ with the actual field name containing your text block. It’s a bit more advanced, but it gives you full control over the parsing process.