you do not need to use RegEx. If your case is as simple as described you can go for the document.location object in the browser.
document.location.pathname will contain what you need. Your code should look something like this:
var pageName = document.location.pathname; // Will replace pageName with homepage if pageName equals "/" or will remove the slashes // This will only work for the first level if you need deeper structures (like www.coches.net/help/customers) to work you should define how this shall look like in your report pageName = pageName == "/" ? "Homepage" : pageName.split("/").join(""); // Will set the first character of pageName to uppercase pageName = pageName.charAt(0).toUpperCase() + pageName.slice(1);
Just go to any website and paste this code to the Console and you will se this work for the first folder level. If you have something like www.domain.com/a/b you will get ab
this depends. How many pages are we talking about? What you can do in the screenshot you provided I would call monkey work;)
If you have really limited pages you can do so, but I would recommend the classification rule builder for this. Once you need to change the naming you will just have to change the rule and everything will be re-classified.
Now you have to decide if you want to do this by hand;)