pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bastiaan Wakkie <bastiaaw@dds.nl>
To: pgsql-php@postgresql.org
Subject: Convert literature string via Regular Expressions
Date: 10 Nov 2003 16:50:58 +0100
Message-ID: <1068479457.5950.13.camel@localhost.localdomain> (raw)

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

view thread (2+ messages)  latest in thread

Message-ID: <1068479457.5950.13.camel@localhost.localdomain>
Permalink:  ../1068479457.5950.13.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1068479457.5950.13.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: bastiaaw@dds.nl
  Subject: Re: Convert literature string via Regular Expressions
  In-Reply-To: <1068479457.5950.13.camel@localhost.localdomain>
  References: <1068479457.5950.13.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox