Regular Expression for @ Array in Perl -
actually m using 1 perl script prepare readme txt builds. in script used
foreach $line (<log>) { if(length(trim($line))>0) { $line=trim($line); $line=~ s/[\r]//gs; if(rindex($line,'#')!=-1) { $icut=substr($line,0,index($line,']')); $icut2=substr($icut,index($icut,'#')+1,length($icut)); } push(@issue,$icut2);
it's fetching correct issue no when situation comes
[i#1303350], [i#1270918],[i#1312521] updated physical confirmation template based on co
then it's fetching 1 issue no not issue same line. modified code
foreach $revno(<rev>) { if(length(trim($revno))>0) { $revno=trim($revno); $revno=~ s/[\r]//gs; if(rindex($revno,'#')!=-1) { $revcut=substr($revno,0,rindex($revno,']')); print "$revcut\n"; $revcut1=substr($revcut,index($revcut,'#')+1,length($revcut)); } } push(@issue,$revcut1);
now it's fetch revision no output 1312588,1303350], [i#1270918],[i#1312521
want remove #
[
]
i
not ,
pls tell me how can parse through regex.
this can done without regular expressions: transliterate: tr///
use warnings; use strict; $s = '1312588,1303350], [i#1270918],[i#1312521'; $s =~ tr/ ][#i//d; print "$s\n"; __end__ 1312588,1303350,1270918,1312521
Comments
Post a Comment