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

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.

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

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

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

Credit : regex - Regular expression for remove link - Stack Overflow

2 Likes

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