invalid file name chars (RegEx)

Peter Osucha <[email protected]> Mon, 25 Jun 2007 15:07:53 -0400
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <[email protected]>
I'm still playing with regular expressions - though I don't get enough
time to devote to the subject.

=20

Anyway, I have a string of characters and all I'm trying to do is make
replace all the invalid file name chars with "" to I can use the
replaced name as a filename.  I am trying to do this with a simple
regular expression statement but this doesn't seem to be working.

=20

            Regex regex =3D new Regex ("[\\/:*?<>|]" );

            string input =3D "Test:*\\is/?<a\bad?.name";

            Console.WriteLine(regex.Replace(input,""));

=20

Can someone please tell me what I'm doing wrong here?

=20

Thanks,

peter

=20

=20


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com