It almost looks like you're working on a backslash, not a forward slash - which did you intend? I presume that's all you want to match, you are ONLY looking for the forward slash on the end of the line?
$scandir=~/\/$/; or my preference, $scandir=~!/$!; -----Original Message----- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 8:38 AM To: '[EMAIL PROTECTED]' Subject: RE: Regualr Expression Again... Thanks for your input for the last question. I am trying to complete a pattern match (Determining if the string ends in a forward slash) and can't get it to work at all using: $scandir =~ /\Z\\/ I have also tried $scandir =~ /$\\/ I can get it to match at the beginning of a string using \A Can anyone advise on what I am doing wrong? I really really really appreaciate your help with this.. Regards, Neil Barlow -----Original Message----- From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 15:15 To: Barlow, Neil Subject: RE: Regualr Expression You're missing a few slashes... $dir =~ s/\\/\//g; Or (more clearly) $dir =~ s|\\|/|g; To use a backslash in a matching expression and have it treated as a backslash (and not an escape sequence), you have to prefix it with another backslash. If a forward-slash is the delimiter for your expression, you have to prefix any forward slash in your expression with a backslash, too. It becomes a kind of hell... Your regex says s/\///g; or "replace every forward-slash with nothing at all (delete them)" -----Original Message----- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 9:05 AM To: [EMAIL PROTECTED] Subject: Regualr Expression Hi all, I am dealing with directories and I read somewhere that it is best to use / rather than \ when dealing with directories. In order to cover my back - I am attempting to parse the string and replace any \ with / using the following: print "Please enter directory to search: "; # directory prompt chomp($dir = <STDIN>); $dir =~ s/\///g; But the regular expression is not replacing the slashes - can anyone assist on this I really appreciate your input Regards, Neil Barlow _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs