logo       

Convert literature string via Regular Expressions: msg#00026

Subject: Convert literature string via Regular Expressions
Hi all,

I'm having difficulties getting the following literature strings ripped to prepare it to be inserted into the database.

Here 2 example strings:

Hauser, M., Geller-Grimm, F. (1995): Bestimmungsschlüssel für die Weibchen der deutschen Sphegina-Arten (Diptera, Syrphidae). [Key to distinguish the females of the Sphegina species known from Germany (Diptera, Syrphidae).] - Entomology 2(1/2), 3-19. London.
Mazánek, L., Láska, P., Bicik, V. (1999): Two new Palaearctic species of Eupeodes similar to E. bucculatus (Diptera, Syrphidae) [] - Volucella 4, 1-9. Stuttgart.

Pattern is like this:
Author(s) (year): Title in German or English. [If filled than former title was a German one and this one is the English translation.] - Source issue, pages. City.

Author:
Year:
Title EN or DE:
Title EN:
Source:
Issue:
Pages:
Press City:

I tried something like this:
	preg_match ("/^[..something..]+/", $string, $regs);

	echo ("Author: ".$regs[1]."<br />");
	echo ("Year: ".$regs[2]."<br />");
	echo ("Title EN or DE: ".$regs[3]."<br />");
	echo ("Title EN: ".$regs[4]."<br />");
	echo ("Source: ".$regs[5]."<br />");
	echo ("Issue: ".$regs[6]."<br />");
	echo ("Pages: ".$regs[7]."<br />");
	echo ("Press City: ".$regs[8]."<br />");
But I'm having problems with the spaces and the parentheses that I somehow can't use in the matching...
Any idea how to split the string in the appropriate parts?

Many thanks,
                 Bastiaan

--
Bastiaan Wakkie <bastiaaw@xxxxxx>
www.syrphidae.com
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe