Hello Bubblers!
I use Twitter’s API to display tweets in my Bubble app. I want to add a link to each hashtag, but I can’t do that dynamically. I was hoping to wrap the hashtag in a URL, but the “Replace by” text field doesn’t read the regex pattern. Do you know of a solution to this issue?
A regex pattern in the “replace” does not have any use because the regex has a meaning only in the “find” part of the operation.
What do you want to accomplish?
Can you provide an example input and the desired output?
Thanks for your reply!
So, let’s pretend that the text that’s returned from Twitter’s API is
“Try out Bubble – it’s a great #nocode tool that you must try!”
Then I want the regex pattern to identify the hashtag ("#nocode", which it currently does), and return the same hashtag wrapped in a URL bb-code so that it becomes clickable and acts as a link. In my case, I would set the URL to mybubbleapp.com/hashtag/[name of the hashtag]
Does this make sense?
If you want to generate the link only ([url=https://mybbubbleapp.com/hashtag/nocode]#nocode[/url]
) and you don’t need the rest of the response you can use “extract with regex”.
If you want to keep the text (Try out Bubble – it’s a great [url=https://mybbubbleapp.com/hashtag/nocode]#nocode[/url] tool that you must try!
) you can use “find and replace” like this:
The symbols $1
$2
refer to the captured groups of the regex.
You can read more about this here and experiment to see which one bubble supports.
Cheers
Mariano
1 Like
That’s amazing Mariano! Really appreciate that you took the time to help me out here