Re: Moving text data into variables
| From: | Jason Wong | Date: | Sun, 04 May 2003 11:41:53 +0000 |
| Subject: | Re: Moving text data into variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146341@lists.php.net to get a copy of this message | ||
On Sunday 04 May 2003 04:34, Richard Kurth wrote:
> Could somebody tell me way this stops at Corp Type: and how I can make
> it process the whole file. I can not change the format of the text
> string in any way but I need to move the data into variables.
>
>
> $f = "Name: WILL PROVIDE, INC. Type: CorporationFile
> Number:C17481-2221State: NEVADA Incorporated On: July 02, 2001Status:
> Current list of officers on fileCorp Type: Non-profitResident Agent:
> AMERICAN LEGAL SERVICES (Accepted)Address: 239 S. SIERRA STREET RENO
> NV89501- President:ROBERT DOBYNS Address: 16843 FM 1314 CONROE TX77302-
> Secretary:RICK PENNY Address: 23026 RED LEO SPRING TX77389-
> Treasurer:DEBORAH PENNY Address: 23026 RED LEO SPRING TX77389-";
Try:
// ugly, but your input data is gross too!
$f = "Name: WILL PROVIDE, INC. Type: CorporationFile Number:C17481-2221State:
NEVADA Incorporated On: July 02, 2001Status: Current list of officers on
fileCorp Type: Non-profitResident Agent: AMERICAN LEGAL SERVICES
(Accepted)Address: 239 S. SIERRA STREET RENO NV89501- President:ROBERT DOBYNS
Address: 16843 FM 1314 CONROE TX77302- Secretary:RICK PENNY Address: 23026
RED LEO SPRING TX77389- Treasurer:DEBORAH PENNY Address: 23026 RED LEO SPRING
TX77389-";
preg_match("/(Name:)(.*)(Type:)(.*)(File Number:)(.*)(State:)(.*)(Incorporated
On:)(.*)(Status:)(.*)(Corp Type:)(.*)(Resident
Agent:)(.*)(Address:)(.*)(President:)(.*)(Address:)(.*)(Secretary:)(.*)(Address:)(.*)(Treasurer:)(.*)(Address:)(.*)/",
$f, $matches);
print_r($matches);
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
How you look depends on where you go.
*/