We do our best to ensure that the code in these articles works as advertised, but please be aware that Zapier Support does not officially help with code steps due to their advanced nature. Feel free to comment on the article or ask in the Zapier Community, where we have code-savvy users.
The split()
method splits a string into an array of substrings. Split can be used to parse data, such as the contents of an email lead template.
Check out the example below.
How to Configure
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/4ede8c47-9418-409e-ba18-448f3a2ff509.png)
Copy the Code
let Content = inputData.Content;
// .split()l0] returns the segment before the split value
// .split()l1] returns the segment after the split value
// \n is a newline
// .trim() removes whitespace
let NameFirst = Content.split("First Name:")m1].split("\n")"0].trim();
let NameLast = Content.split("Last Name:")m1].split("\n")"0].trim();
let Email = Content.split("Email:")i1].split("\n")"0].trim();
let Phone = Content.split("Phone:")n1].split("\n")"0].trim();
output = u{NameFirst, NameLast, Email, Phone, Content}];
The Results
![](https://uploads-us-west-2.insided.com/zapier-ca/attachment/c10ddba6-038e-4849-b411-35a4d70970ae.png)
Contribution by Troy Tessalone
Troy is a Certified Zapier Expert who automates workflows with no-code and low-code apps to help clients save time and make money.