Apply a style to just part of text in repeating group

Hello everyone,

I’m trying to apply a different style for some part of a text. In html I would use a span, but I don’t know how to do it in Bubble.

For example: in the following text, I want all the the words that come after @ to be blue.

This an @example of a @text

Thank you

BB code with rich text editor (inside text element) or multiple text elements that are then grouped together

Well, these texts are in a repeating group cells, so I can use none of these…

Hi there, @fbnc.vntrs… this suggestion feels a bit hacky to me, but it does do what you described. Think this could work for you?

email

Best…
Mike

1 Like

Thank you for your reply. This could work, if I know that I will have only two items, but it might be more or less. You think this would be somehow possible?

Oh, wait… I just assumed it was an email address and went down that path (I guess any time I see @, I automatically think email). What is the context of the thing you are trying to highlight? Is it always going to be a @ symbol followed by some text (like a mention)? As Chris suggested and I demonstrated, you really should be able to use BB code to do what you described. That being said, having an example of exactly what you are trying to do would probably help.

It will be a comment section, and yes it will always be @. Example: @user1 thank you for your reply.

@mikeloc You think they are looking for regex and find and replace?

1 Like

@J805… regex frightens me, but yup. :slight_smile:

1 Like

Haha :joy: Just use https://regex101.com/ to test out any expression.

It’s not as bad as it looks. Just Google an expression and test it out. No need to learn all the expressions or anything. :blush:

1 Like

Thank you for you answer. But I don’t see how with regex I can make all the texts after @ with a different color :sweat_smile:

Assuming a mention can happen anywhere within a text, you need to find all of the mentions and replace them with a formatted (blue) version of the mention. I can’t access the resource to which @J805 linked, but I am quite certain it will get you down the right path.

Sorry to be annoying :sweat_smile:. I tried to use the regex @j805 sent, like shown under, but it doesn’t work, am I using it right?

Maybe try this one instead. Not as complex but might work with the way Bubble handles things. @\S+

1 Like

This works! I have one last question, how I keep the same text, because now I have these results:


image

Edit: I mean just color the @ word, not change it.

Editor: Test805421 | Bubble Editor

Preview: https://test805421.bubbleapps.io/version-test/mentions?debug_mode=true

@fbnc.vntrs Here is an example to show you what I mean.

Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

Thank you @J805 !

1 Like

Glad it helped!

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