need to pull just date out of lines. Date is preceded by (PURCHASED ON|SOLD ON|SETTLED ON). example CLASS A SOLD ON 17/11/10 FOR SETTLEMENT ON 22/11/10 @ 145.59993 just want to grab 17/11/10 as $tdate and 22/11/10 as $sdate
Any help will be appreciated.while(defined($line = (<IN>))){ if ($line =~m/(PURCHASED ON|SOLD ON|SETTLEMENT ON)/) { $desc = (split(/\,/, $line))[27]; #print "$desc\n"; $tdate = (($desc =~ /PURCHASED\s+ON\s+(.*?)\s+/g )||($de +sc =~ /SOLD\s+ON\s+(.*?)\s+/g )); $sdate = $desc =~m/SETTLEMENT\S\s+ON\s+(.*?)\s+/g ; print "TDATE $tdate SDATE $sdate\n"; } }
In reply to help with regex by mmittiga17
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |