Best answer

How to extract ALL occurrences of a word beginning with the same letter/symbol from a text ?

  • 14 April 2021
  • 3 replies
  • 182 views

Userlevel 1
Badge

Hi, I write blog posts.

In each post there are hashtags in the text (not always in the same places).
And I would like to extract ALL the hashtags from my posts.

My trigger is RSS by Zapier. Then I would like to be able to extract all the hashtags from the text.

Maybe with regex, but which code to use please?

Thanks!

icon

Best answer by ikbelkirasan 17 April 2021, 21:43

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.

3 replies

Userlevel 1
Badge

For example, in the following text: 
This item is ideal for your #chill, #easter or #spring events. 

I would like to extract “#chill”, “#easter” and “#spring” with Zapier.

With “Formatter by Zapier” > “Text” > “Extract Pattern”, I’ve tried to use the #\w+ Python expression.

But that only returns me the first Hashtag.

What expression should I use to return ALL hashtags please ?

 

Userlevel 7
Badge +12

Hi @Schizzo - Extract Pattern will only return the first match. 

You might want to consider using my custom integration which can return all the matches:

 

 

 

Userlevel 1
Badge

Hi @ikbelkirasan , wow it works perfectly! 
Thank you very much!