On  4 Nov 2005, [EMAIL PROTECTED] wrote:

> Thanks for a great suggestions. I guess the code you suggested would
> look something like this:

Glad you found it useful.  A quick note on a potentially serious
problem:

It seems entirely possibly that you split an instance of pattern in
the buffer.  That is, if you are searching for "right" you might read
in "I have a ri" in the first read and then "ght to a trial by jury"
in the second read.

If you know the pattern you are looking for won't be split over
multiple lines, you could use readLines instead of readChar.

Depending on the application you could also read "words" or use some
other info about the strucutre of the data you are reading to ensure
you don't ever split a pattern across a read.

+ seth

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to