How do I keep the first (domain) part of the URL and mask everything else after that?
This does not work:
s= ' Get exciting offers when you book a XX year car June XX - XXXX Click here to book http://abc.in/XXzOK '
import re
formatting = [
[r"http://abc.in/", "http://abc.in/XXXX"]
]
for regex,substitution in formatting:
s = re.sub(regex, substitution, s)
print (s)
The domain name can be anything like google.com or yahoo.com
Expected result:
Get exciting offers when you book a XX year car June XX - XXXX Click here to book http://abc.in/XXXXX