On Wednesday, June 23, 2004, at 06:50 PM, Troy Rollins wrote:

I only wish I were parsing any kind of "formed" text. The stuff I am parsing is more like chaos. It can be anything from plain English error messages, to server directory lists, to date and time formats... with NO consistent formatting.

The first job of my parser is to simply try to determine what the heck it is parsing. I currently have it functional, using if-else ifs, contains, etc. I'm considering replacing ALL of that with one powerful matchText, but if that only ends up costing me time rather than saving it...

-- put getElement("<record>", "</record>", myText) into theElement -- put getElementsArray("<record>", "</record>", myText) into theArray

These two functions work with any text for the start spot and any text for the end spot.

If you were parsing an email message you could use something like this:
-- use the getElement() function from my last message.
-- put getElement("<record>", "</record>", tZap) into theElement

From: Troy Rollins <[EMAIL PROTECTED]>
Date: Wed Jun 23, 2004  6:50:59  PM US/Pacific
To: How to use Revolution <[EMAIL PROTECTED]>
Subject: Re: Regex (MatchText) speed
Reply-To: How to use Revolution <[EMAIL PROTECTED]>

put getElement("From:", "Date:", yourEmail) into mFrom
put getElement("Date:", "To:", yourEmail) into mDate
put getElement("To:", "Subject:", yourEmail) into mTo
put getElement("Subject:", "Reply-To:", yourEmail) into mSubject

These example above would require striping the line returns.

To get the body of the email you could use:
put getElement("Reply-To:", "From:", yourEmail) into mBody
...and strip the first line of mBody

Mark

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to