# How can I use regex to clean/normalize user-submitted urls?

**URL:** <https://community.glideapps.com/t/how-can-i-use-regex-to-clean-normalize-user-submitted-urls/33709>\
**Category:** Ask for Help\
**Created:** [October 28, 2021, 9:04pm UTC](https://community.glideapps.com/t/how-can-i-use-regex-to-clean-normalize-user-submitted-urls/33709 "2021-10-28T21:04:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Malcolm\_Lewis](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Malcolm\_Lewis](https://community.glideapps.com/u/Malcolm_Lewis)\
**Post date:** [October 28, 2021, 9:04pm UTC](https://community.glideapps.com/t/how-can-i-use-regex-to-clean-normalize-user-submitted-urls/33709/1 "2021-10-28T21:04:05Z")

</div>

My bookmarking app allows users to submit any URL. I want to clean/normalize these URLs using regex. Eg strip off query params or any chars prior to http\*.

Eg:

`https://www.amazon.com/Thursday-Murder-Club-Novel/dp/B086DL5TVZ/ref=sr_1_1?crid=1PPMMYS04059R&dchild=1&keywords=thursday+murder+club&qid=1635454753&sprefix=thursday%2Caps%2C346&sr=8-1`

is cleaned to:

`https://www.amazon.com/Thursday-Murder-Club-Novel/dp/B086DL5TVZ/ref=sr_1_1`

using regex = ([^?]+)(?.\*)?

Bonus: Once I can do this for a single regex, I’d like to chain regexes for more complex cleaning and standardization. So the result of applying regex1 feeds into regex2, etc.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 28, 2021, 11:26pm UTC](https://community.glideapps.com/t/how-can-i-use-regex-to-clean-normalize-user-submitted-urls/33709/2 "2021-10-28T23:26:29Z")

</div>

If you want to regex it I think you can try this.

> **[Extract Matching Text column • Glide](https://www.glideapps.com/plugins/regex)**
>
> Extract text matching a regular expression.

If you simply want to remove all the query parameters then I think you can try using a split text column on the “?” character, then a single value column to retrieve the 1st part.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 28, 2021, 11:30pm UTC](https://community.glideapps.com/t/how-can-i-use-regex-to-clean-normalize-user-submitted-urls/33709/3 "2021-10-28T23:30:19Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/2/c234839363c1202bb179bac9cdf93d6c3a1e8b16.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/2/e25019b988036c9d463cf0d453b1af8fd313f24f.png)

Works as expected.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [October 29, 2021, 11:31pm UTC](https://community.glideapps.com/t/how-can-i-use-regex-to-clean-normalize-user-submitted-urls/33709/4 "2021-10-29T23:31:08Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
