Remove a link from a string?

Hi there,

I’m trying to remove a link from a string, example random link https://example.com would simply just be random link

How would I go about removing just the link from the string, while still leaving everything else in it?

Any help will be appreciated as always. :slight_smile:

local strings = "random link https://example.com"
strings = strings:gsub("h?t?t?p?s?:?/?/?w?w?w?%.?[%w-]+%.%a+%.?%a*/?.*", "")
print(strings) --random link

This will capture and remove urls in most formats.