On Wed, Feb 27, 2008 at 3:07 PM, Joseph L. Casale <[EMAIL PROTECTED]> wrote: > I am trying to replace all occurrences of a windows path such as "C:\Dir > 1\Dir 2\Dir with more spaces" to a similar path, and have it case > insensitive, and I can't make it work. > Anyone got an idea? I am hoping the syntax is compatible with Sed as my > script has to be ran in two mode's, one being by hand with Sed :( > > Thanks! > jlc >
There are two ways (that I can think of off the top of my head) to make a regex case insensitive: the i option and using character classes: $dir =~ s/C:\\Dir 1\\Dir 2\\Dir with more spaces/$newpath/i; or $dir =~ s/C:\\[Dd][Ii][Rr] 1\\[Dd][Ii][Rr] 2\\[Dd][Ii][Rr] [Ww][Ii][Tt][Hh] [Mm][Oo][Rr][Ee] [Ss][Pp][Aa][Cc][Ee][Ss]/$newpath/; I don't understand why you would run sed. Perl can be run from the command line by hand as well. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/