# How would I remove a url at the end of a message?

**URL:** <https://discourse.nodered.org/t/how-would-i-remove-a-url-at-the-end-of-a-message/46093>\
**Category:** General\
**Created:** [22 May 2021 14:10 UTC](https://discourse.nodered.org/t/how-would-i-remove-a-url-at-the-end-of-a-message/46093 "2021-05-22T14:10:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPGoose](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@JPGoose](https://discourse.nodered.org/u/JPGoose)\
**Post date:** [22 May 2021 14:10 UTC](https://discourse.nodered.org/t/how-would-i-remove-a-url-at-the-end-of-a-message/46093/1 "2021-05-22T14:10:41Z")

</div>

I’m sending Twitter messages to the Alexa service so they can be read aloud but I’d like to remove URL’s that often appear at the end of a tweet. Not sure if this can be done but I thought I’d ask.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2021 14:15 UTC](https://discourse.nodered.org/t/how-would-i-remove-a-url-at-the-end-of-a-message/46093/2 "2021-05-22T14:15:55Z")

</div>

If the tweet comes into node-red then sure you can. Run it through a function that searches for and replaces anything that looks like a URL with `""`. Regex will do the job.

Some examples: "Expression to remove URL links from Twitter tweet - Stack Overflow" [python - Expression to remove URL links from Twitter tweet - Stack Overflow](https://stackoverflow.com/questions/24399820/expression-to-remove-url-links-from-twitter-tweet)

---

<div class="post-metadata">

**Author:** ![JPGoose](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@JPGoose](https://discourse.nodered.org/u/JPGoose)\
**Post date:** [22 May 2021 14:39 UTC](https://discourse.nodered.org/t/how-would-i-remove-a-url-at-the-end-of-a-message/46093/3 "2021-05-22T14:39:51Z")

</div>

Thanks! None of the examples on that page worked but this one did :

```auto
(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)

```

Credit : [regex - Regular expression for remove link - Stack Overflow](https://stackoverflow.com/questions/21932615/regular-expression-for-remove-link)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 June 2021 14:40 UTC](https://discourse.nodered.org/t/how-would-i-remove-a-url-at-the-end-of-a-message/46093/4 "2021-06-05T14:40:00Z")

</div>

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