Forum Academy Marketplace Showcase Pricing Features

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][email protected])?(?: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.

1 Like