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
This regex (a slightly modified version of Joseph's answer), should give you the last segment, minus ending slash.
([^/]+)/?$
Your result will be the first capture group.