a regular expression question

Nicola Paolucci durdn at yahoo.it.oops!.invalid
Sat Mar 22 07:19:53 EST 2003


All,

Nicola Paolucci wrote:
>> If I use re2, it works, but obviously only gets the odds since there
>> is no overlapping.  Is there a way to modify re1 to get the text, or
>> is there a way to overlap with python's re engine somehow?
>>
> This worked for me:
>  >>> re1 = re.compile("<a[^>]+>([0-9]+?)</a>([^<]*)")
>  >>> print re.findall(re1,text)
> [('1', ' abc '), ('2', ' def '), ('3', ' ghi '), ('4', ' jkl')]

I deeply apologyze for the multiple posts. My Mozilla just went crazy ...

ciao,
	Nick





More information about the Python-list mailing list