Re: [Boston.pm] using {3-8} instead of {3, 8} doesn't produce even a warning?

2004-01-27 Thread Ronald J Kimball
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


[Boston.pm] using {3-8} instead of {3, 8} doesn't produce even a warning?

2004-01-27 Thread Tolkin, Steve
Title: using {3-8} instead of {3,8} doesn't produce even a warning?





# 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;
    }
}



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