I want to check whether an URL matches a pattern like: http://the.site.com/some/path/1234567
and simultaneously extract the last number from it.
If I do this so:
Match m = Regex.Match(url, "^http://the.site.com/some/path/(?<picid>.*?)$");
if (m.Success)
{
log(string.Format("New download. Id={0}", m.Groups["picid"].Value));
}
it returns 2 groups. One contains http://the.site.com/some/path/1234567
, the other 1234567
. How to change the regex to get only one capture - the number?