The URL could be one of the following:
http://spappsdev.domain.com/sites/sitename/
http://spappsdev/sites/sitename/
I'd like to extract "spappsdev" in a way that would work for both URL's. Is this even possible? I'd hate to have to run two regex commands.
Try doing this using look around :
Or :
One real life example using perl in a shell :
To assign the result to a shell variable :