Parsing multiple lines from text file using regex

Ben Finney ben+python at benfinney.id.au
Sun Oct 27 19:34:55 EDT 2013


Roy Smith <roy at panix.com> writes:

> In article <op.w5mwa3iaa8ncjz at gnudebeest>,
>  "Rhodri James" <rhodri at wildebst.demon.co.uk> wrote:
>
> > I really, really wouldn't do this with a single regexp.  You'll get a much  
> > easier to understand program if you implement a small state machine  
> > instead.
>
> And what is a regex if not a small state machine?

Regex is not a state machine implemented by the original poster :-)

Or, in other words, I interpret Rhodri as saying that the right way to
do this is by implementing a *different* small state machine, which will
address the task better than the small state machine of regex.

-- 
 \         “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\         Brain, but three round meals a day wouldn't be as hard to |
_o__)                                 swallow.” —_Pinky and The Brain_ |
Ben Finney




More information about the Python-list mailing list