matching and extracting...
shagshag13 at yahoo.fr
Tue Jan 14 22:24:52 CET 2003
Here is my problem : say i have items ix, some are "to discover" (must
be extracted "-x"), some are "needed" (must be present "-p") and some
are indifferent ("-?"). for example, i have sequence like :
s = "a0 a1 a2 a3 a4 a5 a6 a7 a8"
i would like to check if my sequence is matching sequence like :
m = "a0-p i1-x i2-x i3-? a4-p i5-x i6-? i7-x i8-?"
and get result like :
m is matching s, i1 is a1, i2 is a3, i5 is a5, i7 is a7 (in python a
"true" and a dict)
could python help me ? how should i do this ? must i rely on regexps ?
(entirely or prefer text matching ?) have you any ideas, comments of a
pythonic way to implement this ?
thanks in advance,
More information about the Python-list