Re: Help with Regex and trying to mimic the VB "like" comparison

From: Andrew Baker (webmaster_at_vbusers.com)
Date: 06/15/04


Date: 15 Jun 2004 07:54:24 -0700

But I don't want to have to teach hundreds of users how to use regular
expressions, as this is far to complex for their needs. I just want a
simple way of using a wildcard character as per my original post.

cheers
andrew

"Beeeeeeeeeeeeves" <Beeeeeeeeeeeeves@discussions.microsoft.com> wrote in message news:<DB0F13A1-8FC8-4210-A888-E312CA820A56@microsoft.com>...
> You can use regexes, just allow the pattern the user types be the pattern for the regex, but with a few precautions:
> 1) Any characters they type that are regex escapes, you'll need to prefix them with \ to let the regex know they are literals, but beware that you may not want to allow these in the filename anyway.
> See
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconRegularExpressionsLanguageElements.asp (watch for wordwrap)
> 2)
>
> "Andrew Baker" wrote:
>
> > I am trying to write a function which provides my users with a file
> > filter. The filter used to work just using the VB "Like" comparision,
> > but I can't find the equivilant in C#. I looked at RegEx.IsMatch but
> > it behaves quite differently. Is there a way I can mimic the DOS
> > filtering of filenames (eg. "*.*" or "*" returns all files, "*.xls"
> > returns all excel files, "workbook*" returns all files begining with
> > "workbook" etc)?
> >
> > thanks in advance...
> >
> > andrew
> >



Relevant Pages

  • Re: [SLE] Postfix - Sandy - 1 more Q re: /etc/postfix/recepient_check
    ... I'm a little hesitant to answer, because I'm not sure what "regular" means in this case. ... Regular expressions are an absolute must for adminstrators. ... You will encounter these pattern matching expressions in most scripting and programming languages. ... Additionally it will use the content in the round brackets as $1, $2 (content of first found expression in brackets, second found... ...
    (SuSE)
  • Re: [SLE] Postfix - Sandy - 1 more Q re: /etc/postfix/recepient_check
    ... I'm a little hesitant to answer, because I'm not sure what "regular" means in this case. ... Regular expressions are an absolute must for adminstrators. ... You will encounter these pattern matching expressions in most scripting and programming languages. ... Additionally it will use the content in the round brackets as $1, $2 (content of first found expression in brackets, second found... ...
    (SuSE)
  • Re: grep command or operator
    ... expressions. ... I though that 'e' in egrep was just random letter put there. ... egrep - search a file for a pattern using full regular ...
    (comp.unix.solaris)
  • Matching neighbouring words of a pattern using Regex
    ... How can I match 'n' number of neighbouring words of a pattern using regular ... suppose I am looking for the pattern "length xyz cm" in some ...
    (comp.lang.perl.misc)
  • Matching neighbouring words of a pattern using Regex
    ... How can I match 'n' number of neighbouring words of a pattern using regular ... suppose I am looking for the pattern "length xyz cm" in some ...
    (comp.lang.perl)