or maybe explode using ";" as your delimiter first
then loop through the returned array
depending on what the current item is, and the previous item(s) are (maybe
using flags to know where you are, and what has happened), act on the
current one in a certain way

dunno if i've written it in an understandable way, but as Steven says, break
it down into smaller steps


-----Original Message-----
From: Steven Walker [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 1:30 PM
Subject: Re: [PHP] Need help


You could create a function to do this. Just think of it in small steps. 
You can use the string replace function to replace certain parts with 
other characters, or nothing at all. For example:

$data = "Wilson; Hope,(i) Alec Derwent; King,(i) Bruce; James,(i) 
$new_data = str_replace(",(i) ", "\t", $data);

You can then use explode() to put it into an array. You'll have to 
figure out the details, but that should get you started.

Steven J. Walker
Walker Effects

On Wednesday, February 20, 2002, at 06:01  PM, jtjohnston wrote:

> Yeeesch! I neet help.
> I need a method to flush out lists of authors in a MySQL field called
> "KW".
> The field looks a bit like this:
> &&1; Caribbean and West Indies; Guyana;&&4; Birney,(i) Earle; Harris,(i)
> Wilson; Hope,(i) Alec Derwent; King,(i) Bruce; James,(i) Henry;
> Olson,(i) Charles; Rushdie,(i) Salman; Purdy,(i) Al; Joyce,(i) James;
> Macleish,(i) Archibald; Cummings,(i) Edward Estlin (E.E.); Auden,(i) W.
> H.; Atwood,(i) Margaret; Tutuola,(i) Amos; Simon,(i) Claude;&&7;
> comparison of authors and works;
> In the section that starts with &&4
> I need to look for (i) search backward to the prewious ; and search
> forward to the next ; and extract into an array the contents between the
> semi-colons to arrive at something that looks like:
> Birney, Earle
> Harris, Wilson
> Hope, Alec Derwent
> King, Bruce
> James, Henry
> Olson, Charles
> Rushdie, Salman
> Purdy, Al
> Joyce, James
> Macleish, Archibald
> Cummings, Edward Estlin (E.E.)
> Auden, W. H.
> Atwood, Margaret
> Tutuola, Amos
> Simon, Claude
> Can someone please help me get started?
> John
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to