Regular Expressions...Speed, etc.
stephen at cerebralmaelstrom.com
Mon May 29 09:25:09 CEST 2000
First a quick question:
Is the match() function any different really then having search() with a ^
at the begenning of the string?
Now my real question :)
Basically, what I want to do is parse an rfc822 header file.. I don't
want to use rfc822.Message, for various reasons.. Tonight, I went from
reading through the 're' modules instructions to writting the
parsing-portion of the rfc822.Message, and came up with an idea--
Why not just leave all the headers in one string (Or heck, for
ease-of-adding, make them a list, and I can just do --> "".join(HeaderList)
<-- for the search...) and use re.findall?
The reason why is that the specification allows repetitions of the same
field, and I'm going to want MyNewMessage["Received"] to return *all*
occurances of the Received header.
Are regular expressions any slower really then the current method?
More information about the Python-list