Extracting HTML for a message


#1

Hi, I'm trying to input a templated message.

I send emails inside a platform to clients. On this platform somewhere in the HMTL I have a name of the client and the name of his/her assistant. But it is not identified by any CSS class, is there a way in which I can arbitrarily select text from HTML and have it be a part of my text?


#2

You have two options.

The first one would be to use a CSS selector as part of the {site} command. You say the contents isn't associated with the name and email. However, CSS selectors can also be used on element tag names to select nested items or items based on the document structure.

If CSS selector really aren't an option than you can use the extractregex() function to identify the name and email based on surrounding text. For example:

{html="<div>Name: John Doe</div>"} <-- hardcoded for demo purposes, use the site command to get the HTML in practice

Name: {=extractregex(html, "Name: (.*?)<")}

You can learn more about regular expressions here: