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 “https://instagram.com/” Then truncate it from view.
For the facebook you could check the first 21 characters and make sure it is “https://facebook.com/” 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
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.
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.
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?
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…