X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A4A70D1B568 for ; Mon, 10 Nov 2003 16:00:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 30987-07 for ; Mon, 10 Nov 2003 12:00:24 -0400 (AST) Received: from sarek.skynet.be (sarek.skynet.be [195.238.3.230]) by svr1.postgresql.org (Postfix) with ESMTP id D3EB5D1B53B for ; Mon, 10 Nov 2003 12:00:23 -0400 (AST) Received: from 126-17.241.81.adsl.skynet.be (126-17.241.81.adsl.skynet.be [81.241.17.126]) by sarek.skynet.be (8.12.9/8.12.9/Skynet-OUT-2.21) with ESMTP id hAAG02fe002077 for ; Mon, 10 Nov 2003 17:00:02 +0100 (envelope-from ) Subject: Convert literature string via Regular Expressions From: Bastiaan Wakkie Reply-To: bwakkie@syrphidae.com To: pgsql-php@postgresql.org Content-Type: multipart/alternative; boundary="=-0pYwQIU1EBYW409OcWV6" Organization: www.syrphidae.com Message-Id: <1068479457.5950.13.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4-1.1mdk Date: 10 Nov 2003 16:50:58 +0100 X-RAVMilter-Version: 8.4.3(snapshot 20030212) (sarek.skynet.be) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/28 X-Sequence-Number: 2421 --=-0pYwQIU1EBYW409OcWV6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit 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]."
"); echo ("Year: ".$regs[2]."
"); echo ("Title EN or DE: ".$regs[3]."
"); echo ("Title EN: ".$regs[4]."
"); echo ("Source: ".$regs[5]."
"); echo ("Issue: ".$regs[6]."
"); echo ("Pages: ".$regs[7]."
"); echo ("Press City: ".$regs[8]."
"); 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 www.syrphidae.com --=-0pYwQIU1EBYW409OcWV6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit 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@dds.nl>
www.syrphidae.com
--=-0pYwQIU1EBYW409OcWV6--