On 04/29/2012 10:21 AM, lina wrote:
Hi,

I have a text file like:

$ more sample.tex

aaa \cite{d1,d2},ddd \cite{e1},ccc \cite{f1,f2,f3}
bbb\cite{inhibitor}aaa


sub read_tex{
        open my $fh, '<', @_;
        while(<$fh>){
                if(/cite\{(.+?)\}/){
                push @citeditems,split/,/,$1;
                }
        }
        close($fh);
}

It only extract the first \cite part out, failed to extract the e1,
f1, f2, f3 and uncertain number of being cited item out.

Can someone give me some suggest regarding how to upgrade the match part?

Thanks with best regards,


Your regexp only asks for a single \cite... match in each line.

perldoc perlretut

Search for "Global Matching" roughly half-way down the page.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to