Regex question

Eric Arnold umop at psyon.org
Wed Sep 18 17:04:12 EDT 2002


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:

Name:AAA,BBB,CCC

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