>>>You need to test for m.Success
>>>
>>>
>>> string filepath = @"\folder\aaa.bb";
>>> //string filepath = @"\aaa.bb"; // fails
>>>
>>> string pat = @"\\(?:.+)\\(.+)\.(.+)";
>>>
>>>
>>>
>>>
>>> var m = Regex.Match(filepath, pat);
>>>
>>> if (m.Success)
>>> {
>>> Console.WriteLine("{0}", m.Groups[1].Captures[0].ToString());
>>> Console.WriteLine("{0}", m.Groups[2].Captures[0].ToString());
>>> }
>>> else
>>> Console.WriteLine("No match");
>>>
>>>
>>> Console.ReadLine();
>>
>>OK, thanks everyone for their input.
>>
>>m.Success is false.
>>
>>The filepath value is just the filename (AALogo.jpg) not the entire file name and folder, even though what gets displayed in the text box is the full path. Why would this be so? And if it is, why do I need to try to strip out just the file name and how would it know the full path to the file in order to upload it?
>
>I changed my code by getting rid of all teh RegEx stuff and just doing this:
>
>
string fullFileName = @"~/Images/" + this.uplLogo.FileName;
> this.uplLogo.SaveAs(Server.MapPath(fullFileName));
>
>
>
>This seems to work
Getting rid of the Regex ? You throw away all the fun ...
Gregory