It’s been a while so @SirKief has likely already solved this, but thought I’d pop in here to give some solutions just in case:
Remove the last part of the text
The following Pattern can be used in a Formatter (Text > Extract Pattern) step to extract text from between two values:
(?<=start-text)(.*?)(?=end-text)
You’d need to replace start-text with the first value it needs to find, and end-text with the last value it should find. As the start of the email may be different you can leave the start-text value blank and set the end-text value to be the start of the text you want to remove. E.g. (?<=)(.*?)(?= Remove)
While this doesn’t technically remove the last part of the text. It would return the first section of text that was found before the “ Remove” section starts, which essentially remove the last part of text (“ Remove this.”) entirely from the output:
Remove last X characters
I’ve not tested whether it’s possible to remove the last X characters from text using the Extract Pattern Formatter transform as well, but I do know that it’s possible using a Run Javascript Code by Zapier action. For example if you wanted to remove the the last 12 characters from some text you could set up a Code step like so:
Here’s the code that you can copy and edit as necessary:
var trimmedText = inputData.fullText;
//remove last 12 characters from the text
trimmedText = trimmedText.substring(0, trimmedText.length - 12);
//output the text minus the last 12 characters that were trimmed
return {trimmedText};
Then you’d end up with the last 12 characters being removed from the text:
You can find out more about the Extract Pattern and Run Javascript actions here:
Hi @SirKief
Are you able to provide screenshots with how you have your Zap step regex configured and an example of the data you are trying to extract?