develooper Front page | perl.beginners | Postings from April 2002

Re: grep (small doubt)

Thread Previous | Thread Next
From:
Sudarsan Raghavan
Date:
April 3, 2002 01:07
Subject:
Re: grep (small doubt)
Message ID:
3CAAC61A.FCCB75A9@india.hp.com
Mandar Rahurkar wrote:

> I am  using following regexp :
>
>  $skip=1;
>
>  @list_neutral=grep /^.{3,4}[^d][^skip].*\.fea$/, @list;

     This is what this regexp does
     ^ Start of the line, .{3,4} match any character but newline atleast
3 but not more than 4 times
      not followed by 'd', not followed either 's' or 'k' or 'i' or 'p',
0 or more characters except newline, literal '.'
      and finally fea. Is this what you want to match. Can you provide
some example strings.

>
>
> this does not match as 3|4 option matches everything :(
>
> Mandar
> On Wed, 3 Apr 2002, Sudarsan Raghavan wrote:
>
> > Mandar Rahurkar wrote:
> >
> > > Hi,
> > >   Its me again..
> > >
> > > 169b2_vow_band_1.fea
> > > 2168d6_vow_band_1.fea
> > >
> > > @files = grep /^.{3}g[^1].*\.fea$/, @files;
> > >
> > > can i have an or like for eg :
> > > @files = grep /^.{3|4}g[^1].*\.fea$/, @files;
> > >
> >
> >     You can write it as /^.{3,4}g(?!1).*\.fea$/
> >     .{3,4} matches atleast 3 but not more than 4.
> >
> > >
> > > Many Thanks
> > > Mandar
> > >
> > > --
> > > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > > For additional commands, e-mail: beginners-help@perl.org
> >
> >
> > --
> > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > For additional commands, e-mail: beginners-help@perl.org
> >


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About