Such a simple task, but one that trips me up each time. I can do it very easily in TSQL, but sometimes i have to do it in .net scripting, vb or c#.
I tried using Regex below but was just too tired to fight beyound what I had...any help, the old vb.net standard function is what i ended up using...
Dim MyRegex as Regex = New Regex( "[^/]+$", RegexOptions.RightToLeft )
-------------
Private Function GetNameNoPathorExt(ByVal FileNameWithPath) As String
Dim sTemp As String
Dim iPos As Integer
iPos = InStr(FileNameWithPath, ".")
If iPos > 1 Then
sTemp = Left$(FileNameWithPath, iPos - 1)
Else
sTemp = FileNameWithPath
End If
iPos = InStrRev(sTemp, "\")
If iPos > 1 Then
sTemp = Right$(sTemp, Len(sTemp) - iPos)
End If
Return sTemp
End Function