regex question

Rajarshi Guha rajarshi at presidency.com
Mon Apr 5 20:55:00 EDT 2004


Hi,
  this is not specifically a Python question but since I'm doing it in
Python I thought I'd ask here.

I have a BibTeX file with entries of the form

@Article{dkapp3,
  author = 	 {Kier, L.B},
  title = 	 {Distinguishing Atom Differences in a Molecular Graph Index},
  journal = 	 {Quant. Struct.-Act. Relat. Pharmacol.,Chem. Bio},
  year = 	 {1986},
  OPTkey = 	 {},
  volume = 	 {5},
  OPTnumber = 	 {},
  pages = 	 {7-12},
  OPTmonth = 	 {},
  OPTnote = 	 {},
  OPTannote = 	 {}
}

(it also has entries for Book and InBook)

I have an re that is able to get each bibitem: @Article{(.*?)}\n
>From the result I can easily get the key using: @.+?\{(.+?),

I was wondering if it would be possible to do the two things in one re.
That is, first get the string of 1 bibitem and then within that get the
key from the matched bibitem. 

I think I should be using a lookbehind(?) but I'm not sure.

Any pointers would be appreicated

Thanks


-- 
-------------------------------------------------------------------
Rajarshi Guha  <rajarshi at presidency.com> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Q:  What's purple and commutes?
A:  An abelian grape.




More information about the Python-list mailing list