in reply to Re: Regex Problem
in thread Regex Problem

That looks a little weird with the minus in the middle of the character class. Makes it look like a range. I'd sooner write that as

if ( $dir =~ /[^\w-]/ ) {

• another intruder with the mooring in the heart of the Perl

Replies are listed 'Best First'.
Re^3: Regex Problem
by FunkyMonk (Bishop) on Aug 01, 2007 at 18:14 UTC
    I was (mistakenly) under the impression that a character class that ended with a dash was a syntax error, because perl treated it as though it were an unfinished range.

    After reading your post, I tried it in Perl, and of course it works fine. So, I thought it must be an AWKism, but no, it works there too.

    In short, I have no idea why I thought you couldn't end a character class with a dash. Lets just say it must be an age thing.

    Thanks for the enlightenment.