import re str = "http://tt-tests:123/wd/hub"print(re.sub(r"://[^:/]*[:/]?", "://", str))
Standard input is empty
http://123/wd/hub
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!