I have an html string that I want to separate into 3 substrings. Each time there is an < h2 > tag, I want that to be the start of the new section. This way it can go into the body of an email.
I thought I could achieve this by using < h2 > as a a separator in a split function, but its not working as I hoped.
What’s the best approach here? Regex?
Note, I added the space around the tag so it wouldn’t format in the forum.
It is hard to say what the issue is without knowing exactly what you mean by “not working as I hoped”. I just did a quick test and it works fine on my end:
Good point – it looks like this is working apporpriately when I use the Set Variable app opposed to Compose a String like you did.
Is it possible to split the text without removing the beginning < h 2 > tag?
yeah it returns an array so if you want to map this on a field you need to add a get() function to select which item of the array you want.
You can’t split the text without removing the < h 2 > but you can just add it front of your value, like this:
That’s really helpful – this should do the trick then!
Thanks so much for your help!