View Single Post
  #977  
Old 10.10.2019, 21:19
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 644
Default

Quote:
Originally Posted by Demongornot View Post
... how to control those string and character yet for regular expression, replace and all that ...
I had used 'download host' in the expression to make it restrictive. But if the subdomains can be either before or after the domain, based on the examples you provided in this post (pre-edit), you can use broader match pattern, without including the download host in it.

Code:
var link = myDownloadLink;
var url = link.getProperty("LINKDUPEID") || link.getPluginURL();
var shortURL = url.replace(/(^(https?|ftp):\/\/[^\/]+\/)/, "").replace(/.+:\/\//, "");

Last edited by mgpai; 10.10.2019 at 22:32.
Reply With Quote