help need to "read from file until xxxx OR yyyy OR zzzz"

Dar Scott dsc at swcp.com
Sun Dec 12 17:26:48 EST 2004


On Dec 12, 2004, at 3:09 PM, Randy Padawer wrote:

> Let's say a text file occasionally includes the words dogs, cats, and 
> fleas. I need to "read until" any of these words without skipping any.

Unless the file is huge, read it in in one piece with the URL method.

Then repeatedly parse it with matchText or matchChunk.  Match with a 
pattern includes what you want and also allows you to obtain the rest 
of the data for processing more.  I'm guessing that the pattern you 
want includes the front of the string, a bunch of characters, and then 
either one of the words.  The rest is everything after that.  If you 
need help with the regex pattern, just ask.

It would be nice to give a char # offset to matchText or matchChunk, 
but I don't know how.

Dar
****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list