Assuming a single subdomain, how do I replace everything in the URL before the domain and any trailing slashes?
Example strings:
https://www.google.com/
http://net.tutsplus.com/about
The result I want (from my example strings) is:
google.com
tutsplus.com/about
Currently, the regex I'm using is:
^https?:\/\/'
Which results in:
www.google.com/
net.tutsplus.com/about
This replaces everything up to the slashes in the URL, but I want to replace everything up to the first .
My current code in Apps Script is:
var body = DocumentApp.getActiveDocument().getBody();
body.replaceText('^https?:\/\/', '');
Given that I'm using Google Apps Script, it could be an issue with how replaceText()
works. Thanks in advance for the help.