Select specific text in cell
Expanding -- it would certainly be possible for a parser in which
the "\" preceding the filename was optional
And I meant to my last post that doing this, or any other customization of
parsing, would be fruitless without the OP coming back and filling us in
on
what (if any) restrictions exist on his filenames, the descriptions or the
delimiter separating them.
By the way, IF we had to cater to a 'backslashless' path, and IF the
delimiter between the filename and description is in fact a
space/dash/space, the one-liner would become slightly uglier ...
Function fn(str As String) As String
fn = Trim(Split(Split(Replace(str, ":", "\"), "\") _
(UBound(Split(Replace(str, ":", "\"), "\"))), " - ")(0))
End Function
Rick
Well, if the last "-" is the separator between filename and descriptor,
and the
"\" is optional, then the regex is simplified:
re.Pattern = "([^\\]*\S)\s?-[^\\]*$"
As a matter of fact, I think the only circumstance that his regex would
fail
would be if there were a "-" within the descriptor.
Sorry, but I am not up to speed on my RegEx yet... would that retain the c:
from the front of the path or not?
Rick
|