Skip to main content

The end goal is to use a start and end tag to put around content dynamically entered by a user in a form and extract that to a field in Zendesk. 

 

The data coming into Zendesk will look like this:

 

Employee Name: !employee_name_start!John Smith Testing!employee_name_end!

 

The tags are hidden via html 0 size font but are around the dynamically entered content from the user (John Smith Testing). I want to look for the start tag and grab all data between it and the end tag. I have also tried the code below: 

 

import re

m = re.search('!employee_name_start!(.+?)!employee_name_end!', Description) if m: found = m.group(1)

 

My goal is that it will go through the description field (as shown in pic) and look for a starting tag of !employee_name_start! And an ending tag of !employee_name_end! And return whatever is in the middle (.+?) which would be the employees name in this case. My actual description field contains this in it:

Hi @BiometricBrady 

Try using Formatter > Text > Split in your Zap: https://zapier.com/help/create/format/get-started-with-formatter

OR you can use a Code step to do this parsing: https://zapier.com/apps/code/help


Hi @BiometricBrady 

Assuming you will have multiple start & end tags with different names, this could be done dynamically through a javascript code block and using regex. 

This solution uses the tag name to define the output key. 
 

 

 

let regex = /(?<=_start!).*(?=_end!)/g; //this will match anything between _start! and _end!


//match the description against the regex expression
let regexMatches = inputData.description.match(regex);
let matches = {};

//loop through matches splitting at remaining ! to get the key and values
for (var i=0;i<regexMatches.length;i++) {
var match_and_key = regexMatchesMi].split("!");

var key = match_and_keya1];
var match = match_and_keya0];
matchesmkey] = match;
}
return matches


 


Hello,

 

Thank you so much! This worked for me and I am not building out all my flows to include the tags. Thanks again! 

 

Thanks,
Brady