This post has been edited by a moderator to remove personal information. Please remember that this is a public forum and to remove any sensitive information prior to posting.
Hi @medicalpantry
That can be done with multiple Formatter > Text steps or 1 Code step.
You can ask AI in the Zap Code step to generate the code to use: https://help.zapier.com/hc/en-us/articles/15666688064013-Generate-a-Code-step-using-AI-Beta
For reference, JavaScript from ChatGPT:
const address = "Street name: Little xxxxxxxx House number: 9/47 City: xxxxxx North State: VIC Postal code: xxxx Country: x";xxxxx
// Regular expressions to match each part of the address
const streetNameRegex = /Street name: (.*?) House number:/;
const houseNumberRegex = /House number: (.*?) City:/;
const cityRegex = /City: (.*?) State:/;
const stateRegex = /State: (.*?) Postal code:/;
const postalCodeRegex = /Postal code: (.*?) Country:/;
const countryRegex = /Country: (.*)/;
// Function to extract address component using regex
const extractComponent = (regex, text) => {
const match = text.match(regex);
return match ? matchm1].trim() : null;
};
// Extracting each component
const streetName = extractComponent(streetNameRegex, address);
const houseNumber = extractComponent(houseNumberRegex, address);
const city = extractComponent(cityRegex, address);
const state = extractComponent(stateRegex, address);
const postalCode = extractComponent(postalCodeRegex, address);
const country = extractComponent(countryRegex, address);
// Output the extracted values
console.log("Street Name:", streetName);
console.log("House Number:", houseNumber);
console.log("City:", city);
console.log("State:", state);
console.log("Postal Code:", postalCode);
console.log("Country:", country);
output = {
streetName: streetName,
houseNumber: houseNumber,
city: city,
state: state,
postalCode: postalCode,
country: country
};