On Tue, Jan 27, 2004 at 04:55:28PM -0500, Tolkin, Steve wrote:
> # run using e.g. echo hello | perl this-file
> 
> # Why doesn't perl produce a warning from {3-8} ?  This seems
> # to be a syntax error.  It surely is not the way to match strings of length
> 3 - 8.  It
> # should be {3,8} .
> 
> while (<>) {
>     if (/[a-z]{3-8}/) { 
>         print;
>     }
> }

perldoc perlre:

       The following standard quantifiers are recognized:

           *      Match 0 or more times
           +      Match 1 or more times
           ?      Match 1 or 0 times
           {n}    Match exactly n times
           {n,}   Match at least n times
           {n,m}  Match at least n but not more than m times

       (If a curly bracket occurs in any other context, it is treated as a
       regular character.)

In other words, in Perl /[a-z]{3-8}/ is equivalent to /[a-z]\{3-8\}/.

Ronald
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to