I am trying to build an iPhone App, where I read an RSS feed and have to parse out the id of an article from the URL.
The links provided by the RSS feed are like the following:
http://example.com/variable/path/components/352343/index.html
I need 352343.
So basically I need to search for at least one digit between slashes (path components could also contain digits). Regexp would be easy: “//(\d+)//”. But how can I do it with NSScanner?
Thanks,
Ernesto
You can split your url string into parts separated by “/” and check if any part is a valid integer.
or you can simply use NSString method: