RE:Regexp correction

2002-04-29 Thread Jorge Goncalvez

Hi, i have this code :
 opendir(DIR,$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/DHS3Linux);
 
 foreach (readdir(DIR)){
unless (/([Comm]+)/){
$box3-insert('end', $_);
}
}
closedir(DIR);

I wanted to have all that there is in DIR except the directory Comm it works 
great but if i have others directories which contains c o m i don't have it and 
i wanted not to take only the directory Comm and take all others directories.

Where is my mistake.
Thanks. 


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




RE:Regexp correction

2002-04-29 Thread Felix Geerinckx

on Mon, 29 Apr 2002 08:40:13 GMT, [EMAIL PROTECTED] (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


 

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