I have a URL:
www.domain.com/first/second/last/
How do I get the last term between slashes? i.e. last using regular expressions?
last
Here's a simple regex:
[^/]+(?=/$|$)
Should match anything you throw at it.
If you want to look in a particular directory, use this:
/directory.*/([^/]+)/?$
and your result will be in the first capture group.