Mining a file for data
| From: | John Wulff | Date: | Sat, 08 Mar 2003 01:25:32 +0000 |
| Subject: | Mining a file for data | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-138713@lists.php.net to get a copy of this message | ||
I'm just learning PHP so please excuse my ignorance. I'm trying to extract
the data from a simply formatted text file via a simple PHP script. The
goal of this project is to take Magic the Gathering spoiler lists and dump
them into a MySQL database. I've got plenty of experience with MySQL but
not file parsing. How do I about parsing this data? What sort of pattern
recognition do I use (if that's the right term).
Thanks for the help. The format of the file is below.
-John
Card Name: Akroma, Angel of Wrath
Card Color: W
Mana Cost: 5WWW
Type & Class: Creature - Angel Legend
Pow/Tou: 6/6
Card Text: Flying, first strike, trample, haste, protection from black,
protection from red. Attacking doesn't cause Akroma, Angel
of Wrath to tap.
Flavor Text: No rest. No mercy. No matter what.
Artist: Ron Spears
Rarity: R
Card #: 1/145
Card Name: Akroma's Devoted
Card Color: W
Mana Cost: 3W
Type & Class: Creature - Cleric
Pow/Tou: 2/4
Card Text: Attacking doesn't cause Clerics to tap.
Flavor Text: "Akroma asked for only one thing from her troops: unwavering,
unconditional loyalty."
Artist: Dave Dorman
Rarity: U
Card #: 2/145
etc.. etc...