Parsing a text file for information

John Machin sjmachin at lexicon.net
Sat May 18 21:26:43 EDT 2002


On Sun, 19 May 2002 00:52:06 GMT, "Colin Meeks" <colin at meeks.ca>
wrote:

>I have a text file that is several magabytes in size and would like to
>strip it of certain information. The information I want is always
>preceeded by
>    GETTEXT=
>and is in itself 18 characters long.  Is there a regular expression I
>could use to simplify the task.

regex = r'GETTEXT=.{18,18}'
# GETTEXT= followed by 18 characters other than newline

You may want to make this tighter than "characters other than
newline".

You said you wanted to strip the info that is preceded by GETTEXT=.
Are you sure you don't want to strip the GETTEXT= also????



More information about the Python-list mailing list