Date sent:              Thu, 11 Oct 2007 18:30:26 +0500
From:                   [EMAIL PROTECTED]
Subject:                Matching 5th and 6th characted
To:                     beginners@perl.org
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
===== [EMAIL PROTECTED] === 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to