perl.beginners
[Top] [All Lists]

Re: Matching 5th and 6th characted

Subject: Re: Matching 5th and 6th characted
From:
Date: Thu, 11 Oct 2007 19:24:06 +0500
Newsgroups: perl.beginners

The is what I was looking for..Thanks All

----- Original Message -----
From: Jenda Krynicky <Jenda@xxxxxxxxxxx>
Date: Thursday, October 11, 2007 7:40 pm
Subject: Re: Matching 5th and 6th characted
To: beginners@xxxxxxxx


> Date sent:            Thu, 11 Oct 2007 18:30:26 +0500
> From:                 manojkumarg@xxxxxxxxxx
> Subject:              Matching 5th and 6th characted
> To:                   beginners@xxxxxxxx
> Priority:             normal
> 
> > Hello List,
> > 
> > Struck up with a script in using regular expression. There are 6000
> > lines in a csv file in which using an if conditon for a particular
> > column. 
> > 
> > Think one of the column ($arcval) value is APBNSTWAP23. I wanted to
> > take lines from the csv file for those columns whose value is ST for
> > its 5th and 6th character. How can I implement this in perl using reg
> > ex. Help needed. 
> 
>     if ($arcval =~ /^.{4}ST/) {
> 
> this regexp starts searching at the beginning of the string, skips 
> any four characters and checks whether the two that follow are ST.
> 
> HTH, Jenda
> ===== Jenda@xxxxxxxxxxx === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>       -- Terry Pratchett in Sourcery
> 
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
> For additional commands, e-mail: beginners-help@xxxxxxxx
> http://learn.perl.org/
> 
> 

<Prev in Thread] Current Thread [Next in Thread>