Best answer

Question on splitting text

  • 6 June 2020
  • 7 replies
  • 989 views

Userlevel 2
Badge

I have a question on splitting text. 

i have trello cards. In the description I have areas split with tags like this: 

<website></website>

<facebook></facebook> 

etc.

How can I search for and extract text in between a pattern like this? I know the beginning, and I know the end, and i want to extract what’s in between. 

icon

Best answer by Bellevuefineart 19 June 2020, 05:55

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

7 replies

Userlevel 2
Badge

any ideas?

Userlevel 2
Badge

Should I just email tech support when I have questions? Is that the preferred method for Zapier. I’ve never received an answer on the forums without a lot of prodding. 

 

thanks

Userlevel 7
Badge +11

Hi @Bellevuefineart! Your best bet there is likely to use a code step if you’re sending multiple strings where you want to extract data. But if you’re sending it in that exact format with the <website></website> tags then there’s a workaround I can offer you (as I don’t know the specific code you’d want to use).

With a few steps you can get what you need. Here’s what I did (it’s not the cleanest but I think it would work):

  1. I made line items out of the various things that are in the <> </> tags so I can take action on all of them

     

  2. I used Remove HTML Tags (part of our Formatter)

     

  3. I then converted that from line item back to text (under Formatter — Utilities), and it gives me a few different options.

So from there you can use the separate fields or you can use the text field where all your pieces of data are comma-separated. Does that look like something you could use?

Userlevel 2
Badge

thanks very much. I’m going to try that. 

Userlevel 7
Badge +8

Hey @Bellevuefineart - Did the suggestion from @nicksimard work for you? Please let us know if you have any further questions. Thanks!

Userlevel 2
Badge

thanks. I will let you know. I need to test it and it’s a zap that gets used  a lot. Going to try and modify and test it tonight when it’s quieter in the office. 

Userlevel 2
Badge

Sorry it took so long, it’s taken a bit to figure this out and test it. 

I ended up going with something a little different, but this got me on the right track. 

It was 

Formatter by Zapier

Action: Text

Customize Text

Transform string.re_extract 

Input: Trello Card Descripiton

Pattern: <twitter>(.*)</twitter>

 

Repeat this for each set of tags in the description. 

 

This gives me text and titles for Twitter, FB, IG and for my web blog that can then be used in later zapier steps for social media posts. 

 

The only limitation now is that I can’t extract any more than one image attachment from the trello card to use for social media posts. If there is more than one attachment, then it gets downloaded as a zip file and FB posting doesn’t work because there is a zip attachment instead of separate image file attachments. But this is being addressed in another thread as a possible request, and someone at Zapier said others have requested this. 

 

But I’ve come this far, and this part works. And now posting to FB, Web and Twitter all work with one image.