You can
 
$line =~ /^[a-zA-Z]{2,8}$/;
 
 
------------------ 原始邮件 ------------------
发件人: "独孤九剑"<[email protected]>;
发送时间: 2009年11月17日(星期二) 上午8:10
收件人: "Daniel Burgaud"<[email protected]>; 
"Perl-Win32-Users"<[email protected]>;
主题: Re:Need help with RE:

 
       
      $line =~ /[a-zA-Z]{2,8}/;
  
   
  
  ------------------ Original ------------------
  From:  "Daniel Burgaud"<[email protected]>;
 Date:  Mon, Nov 16, 2009 04:27 PM
 To:  "Perl-Win32-Users"<[email protected]>; 
 
 Subject:  Need help with RE:

  
Hi,

my $line = "Unconfirmed";

I need an RE that will give me a TRUE value if the string is 2~8 chars long.
otherwise, it gives FALSE;

I tried

if ($line =~ /\S{2,8}/) {
?? return 1;
} else {
?? return 0;
}

However this does not work.

I cannot use length($line) because it has to be Regular expression.

Thanks.

Dan
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to