Hi, I have a perl regex to test if a file resides under a particular directory. The test looks like this:
if ($filename =~ $directory) { # yes, this filename resides under directory } This is working for most cases. However, it fails is the directory contains a +. For example: $filename = 'ports/www/privoxy+ipv6/files/patch-src::addrlist.c'; $directory = "^/?" . 'ports/www/privoxy+ipv6' . "/"; if ($filename =~ $directory) { # yes, this filename resides under directory } Yes, I can escape the + in the directory name, but then I'd have to test for all special regex characters and escape them too. That sounds awfully complicated. ;) I think it might just be easier to do a straight comparison of the first N characters of the two strings where N = length of the directory name. Any suggestions? thanks -- Dan Langille : http://www.langille.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]