How do you make a list from a text?

I have a regex that extracts hashtags from a text. In my workflow I have “hashtags (data is set as a list) add input value:extract with regex”.

But the problem is that while it extracts #word and multiple #words if there are several, it adds them to the hashtag list as 1 item. When I look up how many items in the list, it says 1 even when there are mutliple hashtags in the text itself. I need a way for each #word to be added to the hashtag list as an individual item. So if there are 3 #words then there are 3 items in the list.

Is there a way to do this?

Have you tried using add list, or set list, instead of add?

yes, unfortunately an issue comes up saying that it should be a list but currently is a text.

I have been trying to figure this out all day.

I have a thing called a post, with a field called “post text” and “hashtag” (hashtag is a list of texts).

Post text= input value

Hashtag= input value:extract with regex (regex extracts hashtags)

When I look at the app data, if a user posts: #word #word #word,
the field for hashtag lists #word, #word, #word

so far so good, but when i try a repeating group or i try to use dynamic text to display the first item of the hashtag, it lists #word #word #word as 1 item in the list. They are grouped as 1 entry.

I need a way to make them separate items in the list of hashtags so that i could have text that displays the 1st item, 2nd item, etc.

This might get you going in the right direction…

EDIT2: Screenshot updated with better regex pattern:

It takes the value of an input, extracts hashtags, and then adds all the hashtags (as a list) to a hashtag_list field (which is a list of texts)

Mind you, I haven’t tested the regex string rigorously, but it seems to handle the easy stuff.

EDIT: The regex is wrong. I’ll find one that works and update.

EDIT2: I think this is working: (^|\s)(#[a-z\d-]+)

it still seems to only group the whole list of words as technically one item, which is the problem i am having.

Maybe if you take a look at the actual app I made: https://bubble.io/page?type=page&name=hashtags&id=toh-samples&tab=tabs-1

If yours is still putting everything into one item, post up some screenshots or a link the the app, and I’m sure the issue can be found.

1 Like

Oh wow, thank you. I dont know how I missed the “set list” function in the workflow. I tried it before but it was giving me an error, I saw your thing and said “hey i tried that why does it give me an error though?”
and I cleared that field box in the workflow step and put it in again and it let me do it. Thank you for sharing! I will test it again but it worked so far. Thank you!!!:muscle::+1::clap::clap::raised_hands::pray:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.