matching multiple regexs to a single line...

maney at pobox.com maney at pobox.com
Wed Nov 20 22:11:23 EST 2002


Alex Martelli <aleax at aleax.it> wrote:
> I accepted it as posted and built on it -- so I don't see why you're
> claiming that this is a differentiator between Alexander's aproach
> and mine.

Because I had been trying to resist this thread, so when I gave in I
was responding somewhat to the whole context... and overlooked that
Alexander had first introduced that.  Quite possibly I didn't read that
one all the way to that code?

>> This is one point on which I agree with Alexander: it seems to me to be
>> the usual case that the regexp both identifies and parses the target.
> 
> It's one case, but it's very far from being the only one.

Right, and I didn't say it was.  I notice you aren't disagreeing that
it's a very common style of use, and this both-identifying-and-parsing
use has been at least implied all along.  It was explicitly described,
though not explicitly shown in the pseudo-code snippets, back in the
first post in this thread.

>> If it isn't being used in that dual mode, then the whole issue
>> addressed here (and in at least two other threads during the past week)
>> doesn't exist.
> 
> Why doesn't it?  Alexander's post to which I was replying had no
> groups at all in the regex patterns 

Not in the sample code, no.  There were groups in a lot of non-code
exposition, and as I say, they've been implicitly and explicitly a
major part of the motivation for this, at least IMO.  After all, if you
don't have any groups, what do you need the match object for outside of
the conditional test?  And then the motivating problem, or at least
what I have seen as the motivating problem, is the dual use of the
result of the regexp's application.

The elephant seems very like a pillar on this side...  :-)



More information about the Python-list mailing list