Oh, of course: 

$result = preg_replace( $p , $r , $s ) ;
But you have probably already figured that.

At 01:28 13.1. 2001, Cynic wrote the following:
-------------------------------------------------------------- 
>try this:
>
>$s = file( 'mylisting.txt' );
>$r = "\\1\t\\2\t\\3" ;
>$p = '~^(.*)\040+(?=\d)(\d+-\d+)(?<=\d)\040+(.*)$~Ui' ;
>
>you might want to limit the possible appearance of the phone 
>numbers more strictly.
>
>At 00:44 13.1. 2001, Jerry Lake wrote the following:
>-------------------------------------------------------------- 
>>Bolgrihn Michael        555-5566        142 Hillyer St  Oxford
>>Bollenbach Gary V       555-5078        315 Freedom Rd  Oxford
>>Bonaguidi Daniel        555-5155        N4663 10th Av   Montello
>>Bonnett Agatha & John   555-5363        547 Fawn Ct     Oxford
>>Bonnett Bernard & Norma 555-4360        116 E Ormsby St Oxford
>>Bonnett Bob & Eleanor   555-5627        527 Fern Av     Oxford
>>
>>Here is a sample from the listing there are numbers in the address
>>as well. 
>>$NewString = ereg_replace("([[:alpha:]]+) ", "\\1".",", $test);
>>that works to an extent, except that it adds the comma after
>>every word that is followed by one space and not just the first occurance
>>
>>Jerry Lake 
>>
>>-----Original Message-----
>>From: Cynic [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, January 12, 2001 3:41 PM
>>To: Jerry Lake; [EMAIL PROTECTED]
>>Subject: RE: [PHP] regex
>>
>>
>>looks like you need to find all the spaces _before_ the _first_ 
>>digit on the row, and _after_ the _last_ digit on the row. 
>>does that fit your data? are there no other numbers than the 
>>telephone ones?
>>
>>At 00:29 13.1. 2001, Jerry Lake wrote the following:
>>-------------------------------------------------------------- 
>>>I have a small phone directory
>>>bust the name listings are combined
>>>for example
>>>Schwartz Bob & Amelia   555-1212        Oxford
>>>Scirkin Bill    555-1213        Brooks
>>>
>>>I need to add a tab or a comma after the
>>>lastname so I can have as a separate field
>>>when I dump it into MySQL and there is about
>>>3500 records and I'd hate to have to do it by hand
>>>any ideas?
>>>
>>>Jerry Lake            - [EMAIL PROTECTED]
>>>
>>>-----Original Message-----
>>>From: Cynic [mailto:[EMAIL PROTECTED]]
>>>Sent: Friday, January 12, 2001 3:25 PM
>>>To: Jerry Lake; [EMAIL PROTECTED]
>>>Subject: RE: [PHP] regex
>>>
>>>
>>>depends. is the set of strings preceeding the space limited 
>>>and known, or is it something like [^abc]{3,12} ?
>>>
>>>
>>>At 00:13 13.1. 2001, Jerry Lake wrote the following:
>>>-------------------------------------------------------------- 
>>>>and how would I go about that?
>>>>
>>>>Jerry Lake
>>>>
>>>>-----Original Message-----
>>>>From: Cynic [mailto:[EMAIL PROTECTED]]
>>>>Sent: Friday, January 12, 2001 3:10 PM
>>>>To: Jerry Lake; [EMAIL PROTECTED]
>>>>Subject: Re: [PHP] regex
>>>>
>>>>
>>>>yes
>>>>
>>>>At 23:54 12.1. 2001, Jerry Lake wrote the following:
>>>>-------------------------------------------------------------- 
>>>>>is it possible with regex to
>>>>>change one or more text characters
>>>>>followed by a space into the same
>>>>>characters followed by a tab?
>>>>>
>>>>>Jerry Lake 
>>>>>
>>>>>
>>>>>-- 
>>>>>PHP General Mailing List (http://www.php.net/)
>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>>>------end of quote------ 
>>>>
>>>>
>>>>
>>>>____________________________________________________________
>>>>Cynic:
>>>>
>>>>A member of a group of ancient Greek philosophers who taught
>>>>that virtue constitutes happiness and that self control is
>>>>the essential part of virtue.
>>>>
>>>>[EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>>
>>>>-- 
>>>>PHP General Mailing List (http://www.php.net/)
>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>>------end of quote------ 
>>>
>>>
>>>
>>>____________________________________________________________
>>>Cynic:
>>>
>>>A member of a group of ancient Greek philosophers who taught
>>>that virtue constitutes happiness and that self control is
>>>the essential part of virtue.
>>>
>>>[EMAIL PROTECTED]
>>>
>>>
>>>
>>>-- 
>>>PHP General Mailing List (http://www.php.net/)
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>-- 
>>>PHP General Mailing List (http://www.php.net/)
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>------end of quote------ 
>>
>>
>>
>>____________________________________________________________
>>Cynic:
>>
>>A member of a group of ancient Greek philosophers who taught
>>that virtue constitutes happiness and that self control is
>>the essential part of virtue.
>>
>>[EMAIL PROTECTED]
>>
>>
>>
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>------end of quote------ 
>
>
>
>____________________________________________________________
>Cynic:
>
>A member of a group of ancient Greek philosophers who taught
>that virtue constitutes happiness and that self control is
>the essential part of virtue.
>
>[EMAIL PROTECTED]
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
------end of quote------ 



____________________________________________________________
Cynic:

A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.

[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to