Front page | perl.beginners |
Postings from April 2002
RE:Regexp correction
Thread Previous
From:
Felix Geerinckx
Date:
April 29, 2002 01:52
Subject:
RE:Regexp correction
Message ID:
Xns91FF6E99A255Cfge123@209.85.157.220
on Mon, 29 Apr 2002 08:40:13 GMT, goncal11@col.bsf.alcatel.fr (Jorge
Goncalvez) wrote:
> foreach (readdir(DIR)){
> unless (/([Comm]+)/){
> $box3->insert('end', $_);
> }
> }
> closedir(DIR);
The [] signal a character class in a regex, meaning 'match any of the
character between the '[]'. The '+' adds 'one or more times' to this.
The '()' are not needed here. They are used to group and/or to capture
parts of the matched string into the special variables $1, $2, ...
If you only want to exclude a string with 'Comm' in it, you could write
unless (/Comm/) {...}
--
felix
Thread Previous