Create a Zapier step to take an email from Gmail and extract 4 data points to populate a Pardot form.

Job ID: 37290161

Budget: $30 – $250 AUD

write code in python to extract the five digit number at the start of "Business Name" and all of the information from the following fields "Name" "email" "phone" from gmail input in the following format to use in Zapier to populate a pardot formhandler.
Email samples will be sent by separate cover.

I know how to set up the email to trigger the zap but have difficulty extracting the required information. I have written the following code but it is erroring out.
# Define regular expressions for each field
business_name_pattern = r"Business Name:[\s\xa0]*(\d{5})"
name_pattern = r"Name:[\s\xa0]*(.*?)\s*\n"
email_pattern = r"Email:[\s\xa0]*(.*?)\s*\n"
phone_pattern = r"Phone:[\s\xa0]*(.*?)\s*\n"

# Extract fields using regular expressions
business_name_match = re.search(business_name_pattern, gmail_email_content)
name_match = re.search(name_pattern, gmail_email_content)
email_match = re.search(email_pattern, gmail_email_content)
phone_match = re.search(phone_pattern, gmail_email_content)

# Check if matches were found
if business_name_match and name_match and email_match and phone_match:
business_name_number = business_name_match.group(1).strip()
name = name_match.group(1).strip()
email = email_match.group(1).strip()
phone = phone_match.group(1).strip()

# Print the extracted information
print("Business Name Number:", business_name_number)
print("Name:", name)
print("Email:", email)
print("Phone:", phone)
else:
print("Fields not found in the email content.")
Related categories: Python Zapier