I am trying to map a subdirectory in the url that comes after a specific directory:
then add the directory to the appropriate line.
/applications/app1 should be /applications/app1/beta
/applications/app2/ should be /applications/app2/beta/
/applications/app2/settings should be /applications/app2/beta/settings
/applications/app3?q=word should be /applications/app3/beta?q=word
I wrote this:
path = path.replace(/(\/applications\/(.*)(\/|\s|\?))/, '$1/beta');
But it does not work if the application name is at the end of the line.
Note. I do not have an application name. I only know that it follows /applications/
source share