On Jul 1, [EMAIL PROTECTED] said:

>\.[^(gz|html)]$
>
>this regex should match all files (lines) NOT ending with gz or html.

No, it shouldn't.  It should match all files ending with a . followed by a
character that is not any of ()|^ghlmtz, followed by the end of the
string.

>but this is not working. the lines ending with .gz are still found.
>whats wrong with that?

The problem is that [...] is a CHARACTER class.  You cannot put a STRING
in a character class.  What you want to do is either change the sense of
your regex entirely:

  if ($filename !~ /\.(gz|html)$/) {
    # the !~ operator means "does not match"
  }

or else use a negative look-ahead:

  if ($filename =~ /\.(?!gz|html)[^.]*$/) {
    # (?!...) means "is not followed by"
  }

I think the first one is easier to understand at this stage.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to