Self referential regular expressions with burried bindings.

David Williams (dwwillia@iucf.indiana.edu)
Wed, 9 Mar 1994 17:11:31 -0500 (EST)

Well, here is a bit tougher one. I don't have any local expertise
to draw on here, so if somebody would volunteer and help me out via e-mail
with dumb questions, I'm sure the list would be thankful.

I want to pull every two characters following % characters out of a string.
I tried this:

>>> print a
asdfasf%12sas%44
>>> t=regex.compile('\(.*%\(..\).*\)*')
>>> t.match(a)
16
>>>
>>> t.group(1,2)
('', '44')

I just cant get it to yank out all instances as the group command shows.
Does Python allow for the above sort of regular expressions?

Also, if that won't work, what is the nicest way to accomplish this?

Thanks for any help.

David Williams, IUCF UNIX support Compute free or die!
dwwillia@indiana.edu Algorithm patents bite.
http://cs.indiana.edu/hyplan/dwwillia.html Join the revolution, use Linux.