Regex pattern to remove URL parameters/UTM

Hi all,

I need some help finding and removing any page path/UTM/querystrings from URLs using a Regex pattern.

For example, if a user visits using I’d like to remove that dynamic data after including the first ‘/’ so that we just get the root domain with https:// and nothing after that.

Any idea the Regex to do so? @NigelG is this something you know about?


1 Like

Thanks Nigel, so is it just the ^(?:https?://)?(?:[^@/\n]+@)?(?:www.)?([^:/?\n]+) in the Regular Expression input that I copy paste into Bubble? This is well beyond my knowledge here…

1 Like

Yes, that is correct.

1 Like

Thank you!

Regex Nigel!

I’m trying to do the opposite of this and cannot seem to figure it out.

I’m trying to get everything AFTER http://www. or https://www

I mean, it works on regex101, but its got a non-matching and a matching group, and I’m not sure how to make it work in bubble.

It is returning the whole string in bubble.


Keep it simple: You desire to remove the protocol identifier, which is everything from the start thru “//”. Find that and replace it:



Now it doesn’t matter if the protocol is http://, https://, ftp://, some_other_protocol_nobody_uses://, etc.


thanks keith!

1 Like

Hey all - I wanted the following and @NigelG kindly helped me out in a private message. I wanted to share for all.

Goal = Extract the query string but keep more than just the root domain


Desired output:

Required regex = ^[^?]+

I realized what I actually needed to do was throw away everything from the “?” on. I managed that with a regex find and replace as follows:

Find: ?(.*)
Replace: [nothing]


This may be helpful to others.

2 Likes has been the tool that has finally enabled me to understand regex and make my own patterns that work for me.

breaking through some search barriers as I type this and having so much fun doing it, that I had to give you an extra nod on here for sharing it.




So reading through this thread again I couldn’t figure how to work with a string like SULFW.M.W.HW.01

What I need is the M.W.HW.01 and remove the SULFW.

The number of the characters before the first dot varies.

I tried using the solution from @keith but ^.. (as in ^.// to remove the http// from a url) results in the entire string being removed.

Does anyone have a suggestion?




Solution to this specific question is:


I found this thread because I was having an issue that I reached out to Bubble support on. The issue is that I wanted to use a conditional that was “This URL is Website Home URL” for navigation purposes.

This should be relatively straight forward, but Bubble actually is tracking our users through the use of a ‘resume’ parameter which we don’t see in the URL except for a brief moment when the page is being navigated (at least with the go to page action).

What this results in on a home page (index page), the ‘this url’ will look like Web Hosting, Domain Name Registration -

and that of course would not match the ‘website home url’ which is

Bubble support told me to use a regex pattern to remove the resume parameter for my conditional to work properly.

Thanks to @GB44 for posting the pattern he used.

This works for me to remove the resume parameter from the URL.

Thanks for sharing this, @GB44 and @NigelG . I just added this in my app, but to get the regex to work I had to add “” to escape the “?”.

Find: ?(.*)
Replace: [nothing]