Regex question

Eric Arnold umop at
Wed Sep 18 17:34:09 EDT 2002

Okay, I have it down to:


which almost works ...

 <eventName>: "Name"
 <eventParam 1>: "AAA"
 <eventParam 2>: "BBB"
 <eventParam 3>: "CCC"
 <eventParam 4>: ""

it's picking up the <eventParam4> on the last character (right after "C")
and it's an empty string.  Shouldn't "CCC" (as captured with the $ end of
string as a delimiter) be the last thing found?


"Eric Arnold" <umop at> wrote in message
news:amapuf$45t8t$1 at
> Hi folks,
> I'm trying to figure out why this is not working, and wonder if there are
> any regexperts out there who can give me a pointer.
> The string I'm capturing is as follows:
> where I'd like to extract the following data:
> <eventName>: Name
> <eventParam 1>: AAA
> <eventParam 2>: BBB
> <eventParam 3>: CCC
> this is the regular expression I wrote to do so:
> (?<eventName>.*):(?<eventParam>([^,]*(?=,))|((?<=,)[^,]*))+
> I tried it with the (?<=,) as another (?=,) too, but no luck.  I imagine
> that the problem is that when the (?=) is used once, it can't be used with
> the second group, but I don't know a way around that.
> Thanks!
> Eric

More information about the Python-list mailing list