Using regexps to clean up html files
| From: | olinux o | Date: | Wed, 27 Jun 2001 19:30:18 +0000 |
| Subject: | Using regexps to clean up html files | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9873@lists.php.net to get a copy of this message | ||
hi all,
I have a very large project where I have to insert
information from a large number of HTML files. They
are pulled from a public web database so they are
somewhat consistent in format. However not all fields
are present in each. So what I have decided to do is.
Write a script that parses the files of extraneous
spaces etc. and inserts into a CSV file to be imported
into the DB structure.
I figure that I can do something like "Grab
information following 'FIELD NAME:' until ' ' (blank
space).
However, Some fields may contain two or more words.
Such as, PROPERTY TYPE: Retail or PROPERTY TYPE:
Industrial Facility
So how do I account for this. I have thought that I
may try to Grab everything BETWEEN two field names
[only this becomes a problem if a field is not
present].
Can anyone give me some tips on writing this script. I
have done very little work with string manipulation.
If you would like some sample files, please contact me
off list.
Thank you so much.
olinux
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/