Extracting domain from a URL

I have an input for ‘website’
I then have an input for email

I want to force the user to use an email from the same domain as the website (to prove they have ownership or are part of the company)

What is the correct function for Bubble to extract the domain (ditching http, https, www…etc)?

I am trying with Regex but cannot get it to work.

1 Like

I had some luck using Find and Replace, but unsure how you list multiple terms to find.

Just to double-check: I’m assuming you tried some StackOverflow ideas?

1 Like

Extract with a regex.


@rico.trevisan I have tried them yes.

@NigelG this is how I have inputted your regex, but this still doesn’t seem to be working.



Sorry, forgot about the Bubble regex weirdness.


@NigelG This works perfectly if www. is in front of the domain.

e.g. https://www.ugenly.com

However it does not work without www.

e.g. https://ugenly.com does not work. It returns the full URL

Is there a fix to cover this as well?

It is a bit of a cludge. But use the first one and then do a search and replace for www. after the regex.

Sorry, didn’t test that bit.

Sorry I cannot get this first regex to work at all:


It does not return any value (with or without the find and replace for www.)

Does Regex work on an input fields value? Or does it need to be pulling it from the database?

It will work on input fields.

Will see if I can get something working on https://ugenly.com/

1 Like

Hi there, @tristan.adlington… this idea is hacky, but you were already headed down this path at one point, so I don’t feel quite as bad about it. :slight_smile:

You can string multiple :find & replace options together, so you would have something like this…

So, that “solution” is there for the taking if you want it… hope this helps.


1 Like

@mikeloc This works! Perfect, thank you very much for your help.

I will mark this as the solution for now…

1 Like

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