matching multiple regexs to a single line...

Alex Martelli aleax at aleax.it
Wed Nov 20 18:25:55 EST 2002


maney at pobox.com wrote:
   ...
> I can somewhat agree with Alexander, and I think you're overlooking the
> way that this approach does force the regexps and their associated
> handler code apart in the source code.  Most of his objections, yes,

So did the approach in the post I was replying to -- there was a list
of pairs, each made up of an identifier and a compiled re object, and
the code was elsewhere.  Personally I like this approach, which is why
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.


>> In some other cases client code may not only need to have no
>> constraints against using groups in the RE patterns, but also
>> want "the match-object" as an argument to the action code.  In
> 
> 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.

> 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 -- are you claiming he was
utterly missing the point of the thread, and his example totally
irrelevant?


Alex




More information about the Python-list mailing list