develooper Front page | perl.beginners | Postings from April 2012

how to get two matches out

Thread Next
From:
lina
Date:
April 29, 2012 08:21
Subject:
how to get two matches out
Message ID:
CAG9cJmmOKah7rcKOqetjkn6-r+kLv2Z0yqUCGmom1vULceHMvA@mail.gmail.com
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,

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About