# Remove links from the text

**URL:** https://community.make.com/t/remove-links-from-the-text/75253
**Category:** Questions
**Tags:** functions
**Created:** [March 15, 2025, 7:26pm UTC](https://community.make.com/t/remove-links-from-the-text/75253 "2025-03-15T19:26:02Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Alex\_Pn](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Alex\_Pn](https://community.make.com/u/Alex_Pn)
#### Post date: [March 15, 2025, 7:26pm UTC](https://community.make.com/t/remove-links-from-the-text/75253/1 "2025-03-15T19:26:02Z")

</div>

Hello!  
I have a msgTxt, that comes from a previous module, and I want to send this msgTxt to GPT assistant BUT i need to get rid of all the links in the message firs. I want to make it by replacing links with text “URL”

What I do, is I use “replace” function, and regular expression.  
Here is what I got now:  
{{replace(12.msgTxt; “(https?|ftp)://(?:(?:[\w-]+.)+[a-zA-Z]{2,}|localhost|\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})(?::\d+)?(?:/[^\s]_)?(?:?[^#\s]_)?(?:#[^\s]\*)?”; “URL”)}}  
I also tried to use simplier regular expression:  
{{replace(12.msgTxt; “(https?|ftp):\/\/[^\s]+”; “URL”)}}  
I tried without “” as well:  
{{replace(12.msgTxt; (https?|ftp):\/\/[^\s]+; “URL”)}}

And no option works. I tried to validate regex with chat gpt, and it says it is correct. Maybe the problem is somewere beyond regex?

Here is screenshot of how I use “replace” function while requesting OpenAI module:

 ![Screenshot at 2025-03-15 20-09-24](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/c/c/ccdc7087f6cc919448c6b70883623136915bf60f.png)

---

_[View the full topic](https://community.make.com/t/remove-links-from-the-text/75253)._
