Help

Extracting a Username from a Social Media Platform URL

Topic Labels: Formulas
3672 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Steven_Whiting
4 - Data Explorer
4 - Data Explorer

Hi

I’m quite new to formulas, but I’m trying to find a formula that would extract a username from a Social Media Profile URL and return the username with an “@” in front of it.

E.g. Taking - https://www.instagram.com/originalsteve/ and returning @originalsteve

I’ve been reading up about REGEX functions, but it’s a little but it seems quite complicated.

Would anyone be able to help?

Thanks

3 Replies 3

Hey @Steven_Whiting!
Welcome in!

This is definitely possible, however, there is one complicating factor that I would like to get some clarifying information on your use case before you can really get a solid answer.

Do you expect to only get URLs from a static list of platforms/websites?

Since each platform can have its own formatting conventions within its URLs, you might want to create a list of the URL formats you expect to come through.

Once you get the sample data together, you’ll want to create ‘rules’ per se.
You’d then use the samples to extract, transform, and validate the usernames in the @userName format.


I’m not too familiar with the different URL formats for given platforms, so I might be making an extra step, but it’s the first thing that comes to my mind.

Hi @Ben.Young

Thanks so much for getting back to me.

This will primarily be for Twitter, Instagram and TikTok, but I might need it for YouTube and Facebook in the future.

Most platforms are:
https://www.“SocialNetwork”.com/“UserName”, but TikTok is slightly different as it already adds an “@” before the user name, so it would be: https://www.“SocialNetwork”.com/@“UserName”

I’ll probably be manually (Copy and Pasting) the URLs into an URL field on Airtable so I get the right ones in as some people can have different usernames on each platform.

Does this help?

Thanks

Hey @Steven_Whiting, you can use Airtable’s substitute() formula and just add an “@” in front of it.

Here’s something to get you started:

"@" & 
SUBSTITUTE(
  SUBSTITUTE(
    SUBSTITUTE(
	    SUBSTITUTE(
		    {Name of field containing your URLs}, 
		    "https://www.youtube.com/c/", 
		    ""
		  ),  
	    "https://www.tiktok.com/@", 
	    ""
	  ),  
    "https://www.instagram.com/", 
    ""
  ), 
  "https://twitter.com/", 
  ""
)