[Tutor] Searching in a file

Alan Gauld alan.gauld at btinternet.com
Thu Jan 14 13:50:22 CET 2010

"spir" <denis.spir at free.fr> wrote 

>> But a third option is to use a split and apply it to the whole file as
>> a string thereby breaking the file into as many chunks as start with
>> a line containing 'NEW'...
> Why not simply a regex pattern starting with "NEW" and ending with '\n'?

Because I understood the OP had to extract the info from 
the lines *following* the one with NEW. You could mess 
around with match object stat positions etc but split seemed a 
much easier solution. 

Alan G

More information about the Tutor mailing list