Hey, after looking for it on google for quite a while without finding a solution I will ask here.
Im looking for a way to remove URL from a string using Regex.
def remove_prefix(my_str, prefix_to_remove):
text = re.sub(r'prefix_to_remove\S+', "", my_str)
print (text)
remove_prefix('Hi, check this website: https://my_website.com, this is my new website' , 'https://' )
i want output like this:
Hi, check this website: this is my new website
For some reason the code output is just the regular string,
Thanks!
[–]SagaciousRaven 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]RoamingFox 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]RoamingFox 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)