python re to replace all urls code example
Example 1: remove web linnks from string python
re.sub(r'http\S+', '', stringliteral)
Example 2: replace url with text python
import re
text = re.sub('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))'+, '', text, flags=re.MULTILINE)