Re: help - parsing text file
| From: | Plutarck | Date: | Thu, 05 Apr 2001 02:03:42 +0000 |
| Subject: | Re: help - parsing text file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-47152@lists.php.net to get a copy of this message | ||
If it's always in that format you could do an explode on "\n", then run the
regex on only the elements of the array you need to rip something from.
So you can build a much simpler and smaller regex to do your work.
--
Plutarck
Should be working on something...
...but forgot what it was.
"Kurth Bemis" <kurth@usaexpress.net> wrote in message
news:4.3.2.7.2.20010404114131.00b2b368@mail.usaexpress.net...
> arg - i' at wits end. i need to parse a text file into a mysql insert
> statement. the statement isn't the problem its parsing the text
> file. heres a sample of the file
>
> West Chesterfield
> (603) 256-8278 V.90
> (603) 307-2100 V.90 & K56flex
> (603) 307-2200 ISDN / DOV
> Hinsdale336
> West Chesterfield256, 307, 614
> Westmoreland399
> Brattleboro, VT(802) 251, 254, 257, 258, 451
> Jacksonville, VT(802) 368, 659
> Newfane, VT(802) 221, 365
> Putney, VT(802) 387, 536
> Williamsville, VT(802) 348
> Wilmington, VT(802) 464
>
> i need to get the town the number is located (west chesterfield in this
> case) the 2 numbers (V.90 and ISDN - there may be more but i only need one
> of each),town(state), and the number. I'm still struggling with rexexp
> expressions...and just can't seem to hack this one around. I'm not
opposed
> to perl.....:-) can ANYONE offer any help?
>
> ~kurth
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>