I knew what I meant, I just didn't write what I meant. Next time, I'll have a coffee first...
Of course you're right I forgot to anchor it too. Rgds, GStC. -----Original Message----- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Saturday, January 22, 2005 8:41 PM To: Perl Beginners Subject: Re: How to find regex at specific location on line Graeme St. Clair wrote: > Try the {} notation, that says how many whats are required before the > which (as it were). Perhaps something like:- > > if (/.{31,33}\|[BNPG]\|/){ > return 2; > } > > Meaning, between 31 & 33 characters. Untested! No, that is not what it means. It means match . (any character except newline) 31, 32 or 33 times and since it is greedy it will usually be 33 times and *then* match \|[BNPG]\|. So it will try to match \|[BNPG]\| at the 34th or later position since the pattern isn't anchored to the beginning of the line. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>