Re: Select specific text in cell

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Sat, 16 Feb 2008 14:52:16 -0500, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx> wrote:

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.
--ron
.



Relevant Pages

  • file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: unbuffered file IO?
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)