I have the following regex which I'm applying to multiple url's on my page.
(/Services\/(.*?)\/People\/(.*?(?=(\.aspx)))/gi)
What I was trying to do was to match and then replace a url structure that looks like the following example:
/Services/FoodService/People/JoeBloggs.aspx
I have the regex working until the lookahead for the .aspx. So any help in spotting what the error with my lookahead is would be much appreciated!
var res = str.match(/Services\/(.*?)\/People\/(.*?(?=(\.aspx)))/gi);
I've broken down the bit I'm having problems with below:
(.*? (?=(\.aspx)))
Any character:
.*?
As long as the lookahead finds an instance of
.aspx
I've checked out these posts as well, but I'm still struggling so all help appreciated!