I have a few problems that break the string the way I want. I have a url:
http:
I am trying to get the TARGETME part in a string using substring and indexOf instead of regex. This is the function I'm working with now:
function lastPartofURL() {
However, when I wrote this, I aimed at the "page.html" part to return, but it is difficult for me to reconfigure it to do what I want it to do now.
If possible, I would like it to start at the beginning of the line, and not end, as there should always be a URL and then one directory before what I'm trying to configure, but I'm interested in both solutions.
Here is a regular expression that does something similar, but it is not protected (according to JSLint), and therefore I would not refuse to replace it with something more functional.
/^.*\/.*\/TARGETME\/page.html.*/
source share