Get all characters after the last '/' (slash) from url string

Viewed 10401

How to get all characters after the last '/' (slash) from url string?

I receive a json string from my URL scheme when making webview request for certain site. For example:

app://ga/ecommerce/%7B%22product%22:%22playstation4%22...}]

I would like to grab the substring after the last '/'(slash).

How can I achieve it? May I know what is the format of Regex?

Avoid to use

NSRange lastDotRange = [sURL rangeOfString:@"/" options:NSBackwardsSearch];

because I might have escaped '/' in my json.

Thank you.

6 Answers
Related