Link clean ups - Need a clever solution

Hi everyone!

We display links to websites, facebook, & instagram on our site.

Does anyone know how to clean up the links? We want to show:
Instagram: @mybusiness
Facebook: mybusiness


I could see how it can be done with logic like for the website link, ‘Remove all text after the .com’, but I don’t know the functions to do this?

Use regex to extract what you want…

1 Like

There are a lot of ways, but if you know the links will always start with

Then you can truncate from start x characters when displayed.

@james34 Do not follow this unless you want to limit your app to only have businesses that only have 7 letters in the primary domain name!!

Edit: This is all wrong

How does what I said have anything to do with 7 characters in the domain name?

If they will always have the same 3 links, A URL, Instagram, Facebook.

For the first link, you could check if the first 8 characters are https:// and if so, truncate them. If not, show the whole link.

For the instagram link you could check the first 22 characters and make sure it is “” Then truncate it from view.

For the facebook you could check the first 21 characters and make sure it is “” Then truncate it from view.

It’s a perfectly simple solution if you’re going to have only a few links. You’re also able to do it using regex as @code-escapee has said. I won’t say anything rude about his comments :heart:

Still doesn’t work.

because this url is supposed to be truncated is from the right so how would he know the character count of where to truncate? The only way to use the suggestion would be to assume all domains of his customers had 7 charachters.

Hey @james34 :wave:

You can try something like this:


Editor: testApp42wCleanDB | Bubble Editor

1 Like

Well. You’re right.

My bad.

I realize in the past when I wanted to do this I did something similar which is why I was so sure it’s possible.

I used number of characters to get the total character Length.
And then truncated from end to a value of Length - Known length of beginning characters to delete.

1 Like

I can’t see Jason’s editor, but you can easily do what you described, @james34, by using the :split by operator. Maybe that’s what he did. :slight_smile:

1 Like

Was waiting for this!


I love that operator! It really is versatile af (as I believe the kids say these days).

1 Like

Oops, I shared it now.


Mike, I’d think that would work most of the times but not catch all urls for example when urls are stored without www or http or with subdomains or when other tlds followed by ? and not a /

That doesn’t remove pages and querystrings etc from url. Also would create issues if user used non https (if that’s even still possible) or linkedin personal page.

Yup, @code-escapee, it would certainly have its limitations if you couldn’t rely on a character for the split. I was thinking the forward slash would be pretty reliable, though, and if you can rely on it, it should be as simple as getting the third item in the split for the website, getting the last item in the split for Instagram (and putting an @ symbol in front of it), and getting the last item in the split for Facebook.

I don’t pretend to know a lot about regex, but wouldn’t it have similar limitations/challenges based on the potentially changing structure?

Yeah, I am working on an alternate example to handle those situations right now. I will post it soon.

well, it’s easier to just say any non letter character than using a split by:.

I have used option sets for oh so many things but never thought of putting a regex expression in there. Thanks for sharing!

1 Like

You inspired me to take it one step further. I just added a option set of Regex expressions and then referenced it as an attribute from other option sets (as a list) so I could just use the display to extract the text and not have to remind myself what the regex did and could easily combine multiple regex expressions…

1 Like

This should work, it’s a little weird on the website one because I couldn’t find a good regex to grab what I needed consistently.

Editor: testApp42wCleanDB | Bubble Editor


Hope that helps :blush:

1 Like