From: Peter Date: 2003-09-18T20:30:14+09:00 Subject: Re: Why IO#readlines does'nt accept a Regexp? > Just a guess: normally it's not necessary and another reason might be > performance, since the overhead of a regexp might be significant for large > files. Another guess... For what I know of regexps, it's that the are compiled to a finite state machine. This compilation is more expensive than the actual use since an FSM only considers each input character once. The only point in splitting at newlines is that newlines tend to occur more frequently than a random regexp match. BTW, what I meant by more expensive is in terms of complexity, i.e., execution time as a function of the size of the input. If your file is large enough, the compilation of the regexp will become negligable since the regexp is small and the file is big. Peter