regex: multiple matching for one string

scriptlearner at gmail.com scriptlearner at gmail.com
Wed Jul 22 21:45:45 EDT 2009


For example, I have a string "#a=valuea;b=valueb;c=valuec;", and I
will like to take out the values (valuea, valueb, and valuec).  How do
I do that in Python?  The group method will only return the matched
part.  Thanks.

p = re.compile('#a=*;b=*;c=*;')
m = p.match(line)
        if m:
             print m.group(),



More information about the Python-list mailing list