Help with regex returning blanks

Hey all!

I’m getting a list of URLs from an API; some are duplicative because of parameters and anchor tags found on the page. I want to clean the URLs from this:
https://somewebsite.com/awesome?p=isforparameter
https://somewebsite.com/awesome#anchorsayyyymatey

To:
https://somewebsite.com/awesome

I have this regex:
(http|ftp|https)://([\w_-]+(?:(?:.[\w_-]+)+))([\w.,@^=%&:/~±]*[\w@^=%&/~±])

It correctly identifies the parts of the URL that I want to keep, as demonstrated here:

But when I use it in Bubble, like so:

I get blanks in the URL text field.

Any suggestions?

See less

This might be a dumb question but have you tried it without the opening “/” and the closing “/i”?

1 Like

A far simpler way to remove the querystring from a URL is:

some_url :split [by ?] :first item

Note: the second item in the split list will be the querystring (sans the “?”), should one exist.

(I realize @jasonahowie has a list of URLs…. You can apply the same principle in :formatted as)

2 Likes

Relied too much on Regex101… thank you.