I bought a book a while ago on Regular Expressions but haven't got around to reading it. Graeme at work gave me this nice little expression to grab the file name from a http path.
string path = “http://www.google.com/test.asp“;
Regex regex =
new Regex(@"[^/]*?/([^/]*?\.\w+)$");
Match fileNameMatch = regex.Match(path);
string fileName = fileNameMatch.Result("$1");
I really need to spend some more time learing this as it a really tidy way instead of looping through the string!